thermok 2.0.0.0
thermok.h File Reference

This file contains API for Thermo K Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  thermok_t
 Click ctx object definition. More...
 
struct  thermok_cfg_t
 Click configuration structure definition. More...
 
struct  thermok_alert_t
 Alert structure definition. More...
 

Macros

#define THERMOK_MAP_MIKROBUS(cfg, mikrobus)
 
#define THERMOK_RETVAL   uint8_t
 
#define THERMOK_OK   0x00
 
#define THERMOK_INIT_ERROR   0xFF
 
#define THERMOK_DEVICE_SLAVE_ADDR_0   0x60
 
#define THERMOK_DEVICE_SLAVE_ADDR_1   0x61
 
#define THERMOK_DEVICE_SLAVE_ADDR_2   0x62
 
#define THERMOK_DEVICE_SLAVE_ADDR_3   0x63
 
#define THERMOK_DEVICE_SLAVE_ADDR_4   0x64
 
#define THERMOK_DEVICE_SLAVE_ADDR_5   0x65
 
#define THERMOK_DEVICE_SLAVE_ADDR_6   0x66
 
#define THERMOK_DEVICE_SLAVE_ADDR_7   0x67
 
#define THERMOK_REG_HOT_JUNCTION_TEMP_THR   0x00
 
#define THERMOK_REG_JUNCTIONS_TEMP_DELTA_THR   0x01
 
#define THERMOK_REG_COLD_JUNCTION_TEMP_THR   0x02
 
#define THERMOK_REG_RAW_ADC_DATA   0x03
 
#define THERMOK_REG_STATUS   0x04
 
#define THERMOK_REG_SENSOR_CONFIG   0x05
 
#define THERMOK_REG_DEVICE_CONFIG   0x06
 
#define THERMOK_REG_ALERT1_CONFIG   0x08
 
#define THERMOK_REG_ALERT2_CONFIG   0x09
 
#define THERMOK_REG_ALERT3_CONFIG   0x0A
 
#define THERMOK_REG_ALERT4_CONFIG   0x0B
 
#define THERMOK_REG_ALERT1_HYSTERESIS   0x0C
 
#define THERMOK_REG_ALERT2_HYSTERESIS   0x0D
 
#define THERMOK_REG_ALERT3_HYSTERESIS   0x0E
 
#define THERMOK_REG_ALERT4_HYSTERESIS   0x0F
 
#define THERMOK_REG_ALERT1_LIMIT   0x10
 
#define THERMOK_REG_ALERT2_LIMIT   0x11
 
#define THERMOK_REG_ALERT3_LIMIT   0x12
 
#define THERMOK_REG_ALERT4_LIMIT   0x13
 
#define THERMOK_REG_DEVICE_ID   0x20
 
#define THERMOK_SCFG_TYPE_K   0x00
 
#define THERMOK_SCFG_TYPE_J   0x10
 
#define THERMOK_SCFG_TYPE_T   0x20
 
#define THERMOK_SCFG_TYPE_N   0x30
 
#define THERMOK_SCFG_TYPE_S   0x40
 
#define THERMOK_SCFG_TYPE_E   0x50
 
#define THERMOK_SCFG_TYPE_B   0x60
 
#define THERMOK_SCFG_TYPE_R   0x70
 
#define THERMOK_SCFG_FILTER_COEFFICIENT_0   0x00
 
#define THERMOK_SCFG_FILTER_COEFFICIENT_1   0x01
 
#define THERMOK_SCFG_FILTER_COEFFICIENT_2   0x02
 
#define THERMOK_SCFG_FILTER_COEFFICIENT_3   0x03
 
#define THERMOK_SCFG_FILTER_COEFFICIENT_4   0x04
 
#define THERMOK_SCFG_FILTER_COEFFICIENT_5   0x05
 
#define THERMOK_SCFG_FILTER_COEFFICIENT_6   0x06
 
#define THERMOK_SCFG_FILTER_COEFFICIENT_7   0x07
 
#define THERMOK_DCFG_COLD_JUNCTION_RES_0p0625   0x00
 
#define THERMOK_DCFG_COLD_JUNCTION_RES_0p25   0x80
 
#define THERMOK_DCFG_ADC_RES_18bit   0x00
 
#define THERMOK_DCFG_ADC_RES_16bit   0x20
 
#define THERMOK_DCFG_ADC_RES_14bit   0x40
 
#define THERMOK_DCFG_ADC_RES_12bit   0x60
 
#define THERMOK_DCFG_NUM_TEMP_SAMPLES_1   0x00
 
#define THERMOK_DCFG_NUM_TEMP_SAMPLES_2   0x04
 
#define THERMOK_DCFG_NUM_TEMP_SAMPLES_4   0x08
 
#define THERMOK_DCFG_NUM_TEMP_SAMPLES_8   0x0C
 
#define THERMOK_DCFG_NUM_TEMP_SAMPLES_16   0x10
 
#define THERMOK_DCFG_NUM_TEMP_SAMPLES_32   0x14
 
#define THERMOK_DCFG_NUM_TEMP_SAMPLES_64   0x18
 
#define THERMOK_DCFG_NUM_TEMP_SAMPLES_128   0x1C
 
#define THERMOK_DCFG_MODE_NORMAL_OPERATION   0x00
 
#define THERMOK_DCFG_MODE_SHUTDOWN   0x01
 
#define THERMOK_DCFG_MODE_BURST   0x02
 
#define THERMOK_ACFG_INTERRUPT_CLEAR_1   0x80
 
#define THERMOK_ACFG_INTERRUPT_CLEAR_0   0x00
 
#define THERMOK_ACFG_ALERT_MONITOR_TC   0x10
 
#define THERMOK_ACFG_ALERT_MONITOR_TH   0x00
 
#define THERMOK_ACFG_ALERT_LIMIT_RISING   0x08
 
#define THERMOK_ACFG_ALERT_LIMIT_FALLING   0x00
 
#define THERMOK_ACFG_ALERT_ACTIVE_HIGH   0x04
 
#define THERMOK_ACFG_ALERT_ACTIVE_LOW   0x00
 
#define THERMOK_ACFG_ALERT_MODE_INTERRUPT   0x02
 
#define THERMOK_ACFG_ALERT_MODE_COMPARATOR   0x00
 
#define THERMOK_ACFG_ALERT_OUT_ENABLED   0x01
 
#define THERMOK_ACFG_ALERT_OUT_DISABLED   0x00
 
#define THERMOK_AHYS_HYSTERESIS_128C   0x80
 
#define THERMOK_AHYS_HYSTERESIS_64C   0x40
 
#define THERMOK_AHYS_HYSTERESIS_32C   0x20
 
#define THERMOK_AHYS_HYSTERESIS_16C   0x10
 
#define THERMOK_AHYS_HYSTERESIS_8C   0x08
 
#define THERMOK_AHYS_HYSTERESIS_4C   0x04
 
#define THERMOK_AHYS_HYSTERESIS_2C   0x02
 
#define THERMOK_AHYS_HYSTERESIS_1C   0x01
 
#define THERMOK_ALIMIT_1024C   0x4000
 
#define THERMOK_ALIMIT_512C   0x2000
 
#define THERMOK_ALIMIT_255C   0x1000
 
#define THERMOK_ALIMIT_128C   0x0800
 
#define THERMOK_ALIMIT_64C   0x0400
 
#define THERMOK_ALIMIT_32C   0x0200
 
#define THERMOK_ALIMIT_16C   0x0100
 
#define THERMOK_ALIMIT_8C   0x0080
 
#define THERMOK_ALIMIT_4C   0x0040
 
#define THERMOK_ALIMIT_2C   0x0020
 
#define THERMOK_ALIMIT_1C   0x0010
 
#define THERMOK_ALIMIT_0p5C   0x0008
 
#define THERMOK_ALIMIT_0p25C   0x0004
 
#define THERMOK_ALIMIT_SIGN_1   0x8000
 
#define THERMOK_ALIMIT_SIGN_0   0x0000
 
#define THERMOK_DEVICE_ID   0x40
 
#define THERMOK_DEVICE_REV   0x10
 
#define THERMOK_DEVICE_INFO   0x4010
 
#define THERMOK_TEMP_IN_FAHRENHEIT   0x02
 
#define THERMOK_TEMP_IN_KELVIN   0x01
 
#define THERMOK_TEMP_IN_CELSIUS   0x00
 

Functions

void thermok_cfg_setup (thermok_cfg_t *cfg)
 Config Object Initialization function.
 
THERMOK_RETVAL thermok_init (thermok_t *ctx, thermok_cfg_t *cfg)
 Initialization function.
 
void thermok_generic_write (thermok_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void thermok_generic_read (thermok_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint16_t thermok_get_device_info (thermok_t *ctx)
 Functions for read device info.
 
void thermok_get_status (thermok_t *ctx, thermok_alert_t *status)
 Get status.
 
float thermok_get_temperature (thermok_t *ctx, uint8_t reg, uint8_t temp_format)
 Temperature data.
 
void thermok_set_register_cfg (thermok_t *ctx, uint8_t reg_cfg, uint8_t cfg_data)
 Set register config.
 
uint8_t thermok_get_alert_state_1 (thermok_t *ctx)
 Alert 1 pin state.
 
uint8_t thermok_get_alert_state_2 (thermok_t *ctx)
 Alert 2 pin state.
 
uint8_t thermok_get_alert_state_3 (thermok_t *ctx)
 Alert 3 pin state.
 
uint8_t thermok_get_alert_state_4 (thermok_t *ctx)
 Alert 4 pin state.
 

Detailed Description

This file contains API for Thermo K Click driver.