Go to the documentation of this file.
38 #include "drv_digital_in.h"
39 #include "drv_i2c_master.h"
57 #define _TEMPLOG2_TEMP_REG 0x00
58 #define _TEMPLOG2_CONFIG_REG 0x01
59 #define _TEMPLOG2_HIGH_LIMIT_REG 0x02
60 #define _TEMPLOG2_LOW_LIMIT_REG 0x03
61 #define _TEMPLOG2_EEPROM_UNLOCK_REG 0x04
62 #define _TEMPLOG2_EEPROM1_REG 0x05
63 #define _TEMPLOG2_EEPROM2_REG 0x06
64 #define _TEMPLOG2_EEPROM3_REG 0x07
65 #define _TEMPLOG2_EEPROM4_REG 0x08
66 #define _TEMPLOG2_ID_REG 0x0F
73 #define _TEMPLOG2_15_MILISEC_0_AVG 0x00
74 #define _TEMPLOG2_125_MILISEC_0_AVG 0x0080
75 #define _TEMPLOG2_250_MILISEC_0_AVG 0x0100
76 #define _TEMPLOG2_500_MILISEC_0_AVG 0x0180
77 #define _TEMPLOG2_1_SEC_0_AVG 0x0200
78 #define _TEMPLOG2_4_SEC_0_AVG 0x0280
79 #define _TEMPLOG2_8_SEC_0_AVG 0x0300
80 #define _TEMPLOG2_16_SEC_0_AVG 0x0380
81 #define _TEMPLOG2_125_MILISEC_8_AVG 0x0020
82 #define _TEMPLOG2_250_MILISEC_8_AVG 0x0120
83 #define _TEMPLOG2_500_MILISEC_8_AVG 0x01A0
84 #define _TEMPLOG2_1_SEC_8_AVG 0x0220
85 #define _TEMPLOG2_4_SEC_8_AVG 0x02A0
86 #define _TEMPLOG2_8_SEC_8_AVG 0x0320
87 #define _TEMPLOG2_16_SEC_8_AVG 0x03A0
88 #define _TEMPLOG2_500_MILISEC_32_AVG 0x0040
89 #define _TEMPLOG2_1_SEC_32_AVG 0x0240
90 #define _TEMPLOG2_4_SEC_32_AVG 0x02C0
91 #define _TEMPLOG2_8_SEC_32_AVG 0x0340
92 #define _TEMPLOG2_16_SEC_32_AVG 0x03C0
93 #define _TEMPLOG2_1_SEC_64_AVG 0x0060
94 #define _TEMPLOG2_4_SEC_64_AVG 0x02E0
95 #define _TEMPLOG2_8_SEC_64_AVG 0x0360
96 #define _TEMPLOG2_16_SEC_64_AVG 0x03E0
97 #define _TEMPLOG2_POL_ACTIVE_LOW 0x00
98 #define _TEMPLOG2_POL_ACTIVE_HIGH 0x0008
99 #define _TEMPLOG2_PIN_ALERT_FLAGS 0x00
100 #define _TEMPLOG2_PIN_DATAREADY_FLAG 0x0004
106 #define _TEMPLOG2_LOCK_EEPROM 0x00
107 #define _TEMPLOG2_UNLOCK_EEPROM 0x8000
114 #define _TEMPLOG2_0_CELSIUS 0x00
115 #define _TEMPLOG2_1_CELSIUS_POS 0x0080
116 #define _TEMPLOG2_25_CELSIUS_POS 0x0C80
117 #define _TEMPLOG2_25_CELSIUS_NEG 0xF380
118 #define _TEMPLOG2_100_CELSIUS_POS 0x3200
119 #define _TEMPLOG2_256_CELSIUS_POS 0x7FFF
120 #define _TEMPLOG2_256_CELSIUS_NEG 0x8000
127 #define _TEMPLOG2_CONT_CONV_OP_MODE 0x00
128 #define _TEMPLOG2_SHUTDOWN_OP_MODE 0x01
129 #define _TEMPLOG2_ONE_SHOT_OP_MODE 0x02
130 #define _TEMPLOG2_ALERT_MODE 0x00
131 #define _TEMPLOG2_THERM_MODE 0x01
140 #define _TEMPLOG2_DATA_READY_MASK 0x01
141 #define _TEMPLOG2_LOW_LIMIT_MASK 0x02
142 #define _TEMPLOG2_HIGH_LIMIT_MASK 0x04
143 #define _TEMPLOG2_BUSY_MASK 0x4000
157 #define _TEMPLOG2_OK 0x00
158 #define _TEMPLOG2_INVALID_ADDR 0xFF
159 #define _TEMPLOG2_INVALID_PARAM 0xFE
160 #define _TEMPLOG2_INIT_DRV_ERROR 0xFD
167 #define TEMPLOG2_RETVAL uint8_t
176 #define TEMPLOG2_MAP_MIKROBUS( cfg, mikrobus ) \
177 cfg.alt = MIKROBUS( mikrobus, MIKROBUS_INT ); \
178 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
179 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
378 #endif // _TEMPLOG2_H_
void templog2_reset(templog2_t *ctx)
Reset function.
void templog2_default_config(templog2_t *ctx)
Click Default Configuration function.
i2c_master_data_t slave_addr
Definition: templog2.h:199
digital_in_data_t templog2_check_alert(templog2_t *ctx)
Alert Checking function.
i2c_master_t i2c
Definition: templog2.h:196
digital_in_t alt
Definition: templog2.h:195
float templog2_read_temp(templog2_t *ctx)
Read Temperature function.
TEMPLOG2_RETVAL templog2_write_eeprom(templog2_t *ctx, uint8_t eeprom_addr, uint16_t data_in)
EEPROM Writing function.
TEMPLOG2_RETVAL templog2_init(templog2_t *ctx, templog2_cfg_t *cfg)
Click Initialization function.
#define TEMPLOG2_RETVAL
Definition: templog2.h:167
pin_name_t alt
Definition: templog2.h:209
void templog2_cfg_setup(templog2_cfg_t *cfg)
Configuration Object Setup function.
TEMPLOG2_RETVAL templog2_write_reg(templog2_t *ctx, uint8_t reg_addr, uint16_t transfer_data)
Write Register function.
pin_name_t scl
Definition: templog2.h:210
bool addr_sel
Definition: templog2.h:217
TEMPLOG2_RETVAL templog2_read_reg(templog2_t *ctx, uint8_t reg_addr, uint16_t *data_out)
Read Register function.
pin_name_t sda
Definition: templog2.h:211
TEMPLOG2_RETVAL templog2_set_mode(templog2_t *ctx, uint8_t op_mode, uint8_t alert_mode)
Mode Setting function.
uint8_t templog2_data_ready(templog2_t *ctx)
Data Ready function.
Click context object definition.
Definition: templog2.h:192
Click configuration structure definition.
Definition: templog2.h:206