Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_one_wire.h"
69 #define TEMPLOG7_CMD_CONVERT_TEMP 0x44
70 #define TEMPLOG7_CMD_ALERT_SEARCH 0xEC
71 #define TEMPLOG7_CMD_WRITE_SCRATCHPAD_1 0x4E
72 #define TEMPLOG7_CMD_READ_SCRATCHPAD_1 0xBE
73 #define TEMPLOG7_CMD_COPY_SCRATCHPAD_1 0x48
74 #define TEMPLOG7_CMD_WRITE_SCRATCHPAD_2 0x0F
75 #define TEMPLOG7_CMD_READ_SCRATCHPAD_2 0xAA
76 #define TEMPLOG7_CMD_COPY_SCRATCHPAD_2 0x55
77 #define TEMPLOG7_CMD_READ_EEPROM 0xF0
78 #define TEMPLOG7_CMD_GPIO_WRITE 0xA5
79 #define TEMPLOG7_CMD_GPIO_READ 0xF5
97 #define TEMPLOG7_TEMP_RES_16BIT 0.0078125f
98 #define TEMPLOG7_TEMP_RES_12BIT 0.0625f
104 #define TEMPLOG7_STATUS_ALERT_HIGH 0x80
105 #define TEMPLOG7_STATUS_ALERT_LOW 0x40
106 #define TEMPLOG7_STATUS_RESERVED 0x30
107 #define TEMPLOG7_STATUS_DATA_VALID 0x08
108 #define TEMPLOG7_STATUS_POWER_MODE 0x04
109 #define TEMPLOG7_STATUS_ARB_DONE 0x02
110 #define TEMPLOG7_STATUS_LOCK_STATUS 0x01
116 #define TEMPLOG7_CFG1_TEMP_FMT_12_BIT 0x00
117 #define TEMPLOG7_CFG1_TEMP_FMT_16_BIT 0x80
118 #define TEMPLOG7_CFG1_TEMP_FMT_MASK 0x80
119 #define TEMPLOG7_CFG1_RESERVED 0x40
120 #define TEMPLOG7_CFG1_CONV_TIME_SEL_3MS 0x00
121 #define TEMPLOG7_CFG1_CONV_TIME_SEL_5p5MS 0x20
122 #define TEMPLOG7_CFG1_CONV_TIME_SEL_MASK 0x20
123 #define TEMPLOG7_CFG1_ALERT_MODE_ALERT 0x00
124 #define TEMPLOG7_CFG1_ALERT_MODE_COMPARATOR 0x10
125 #define TEMPLOG7_CFG1_ALERT_MODE_MASK 0x10
126 #define TEMPLOG7_CFG1_AVG_SEL_NO_AVG 0x00
127 #define TEMPLOG7_CFG1_AVG_SEL_8_B2B_CONV 0x08
128 #define TEMPLOG7_CFG1_AVG_SEL_MASK 0x08
129 #define TEMPLOG7_CFG1_CONV_MODE_SEL_ONE_SHOT 0x00
130 #define TEMPLOG7_CFG1_CONV_MODE_SEL_STACKED 0x01
131 #define TEMPLOG7_CFG1_CONV_MODE_SEL_AUTO 0x02
132 #define TEMPLOG7_CFG1_CONV_MODE_SEL_MASK 0x07
138 #define TEMPLOG7_CFG2_OD_DIS 0x00
139 #define TEMPLOG7_CFG2_OD_EN 0x80
140 #define TEMPLOG7_CFG2_OD_MASK 0x80
141 #define TEMPLOG7_CFG2_FLEX_ADDR_MODE_HOST 0x00
142 #define TEMPLOG7_CFG2_FLEX_ADDR_MODE_IO 0x20
143 #define TEMPLOG7_CFG2_FLEX_ADDR_MODE_RES 0x40
144 #define TEMPLOG7_CFG2_FLEX_ADDR_MODE_IO_RES 0x60
145 #define TEMPLOG7_CFG2_FLEX_ADDR_MODE_MASK 0x60
146 #define TEMPLOG7_CFG2_ARB_MODE_DIS 0x00
147 #define TEMPLOG7_CFG2_ARB_MODE_SOFT_EN 0x10
148 #define TEMPLOG7_CFG2_ARB_MODE_FAST_EN 0x18
149 #define TEMPLOG7_CFG2_ARB_MODE_MASK 0x18
150 #define TEMPLOG7_CFG2_HYSTERESIS_5_C 0x00
151 #define TEMPLOG7_CFG2_HYSTERESIS_10_C 0x02
152 #define TEMPLOG7_CFG2_HYSTERESIS_15_C 0x04
153 #define TEMPLOG7_CFG2_HYSTERESIS_20_C 0x06
154 #define TEMPLOG7_CFG2_HYSTERESIS_MASK 0x06
155 #define TEMPLOG7_CFG2_LOCK_DIS 0x00
156 #define TEMPLOG7_CFG2_LOCK_EN 0x01
157 #define TEMPLOG7_CFG2_LOCK_MASK 0x01
163 #define TEMPLOG7_TEMP_ALERT_LOW 5.0f
164 #define TEMPLOG7_TEMP_ALERT_HIGH 40.0f
165 #define TEMPLOG7_TEMP_OFFSET 0.0f
171 #define TEMPLOG7_IO_READ_NIO3_STATE 0x80
172 #define TEMPLOG7_IO_READ_NIO2_STATE 0x40
173 #define TEMPLOG7_IO_READ_NIO1_STATE 0x20
174 #define TEMPLOG7_IO_READ_NIO0_STATE 0x10
175 #define TEMPLOG7_IO_READ_IO3_STATE 0x08
176 #define TEMPLOG7_IO_READ_IO2_STATE 0x04
177 #define TEMPLOG7_IO_READ_IO1_STATE 0x02
178 #define TEMPLOG7_IO_READ_IO0_STATE 0x01
184 #define TEMPLOG7_IO_CFG_IO3_SEL_INPUT 0x00
185 #define TEMPLOG7_IO_CFG_IO3_SEL_OUTPUT_LOW 0x80
186 #define TEMPLOG7_IO_CFG_IO3_SEL_OUTPUT_HIGH 0xC0
187 #define TEMPLOG7_IO_CFG_IO3_SEL_MASK 0xC0
188 #define TEMPLOG7_IO_CFG_IO2_SEL_INPUT 0x00
189 #define TEMPLOG7_IO_CFG_IO2_SEL_ALERT 0x10
190 #define TEMPLOG7_IO_CFG_IO2_SEL_OUTPUT_LOW 0x20
191 #define TEMPLOG7_IO_CFG_IO2_SEL_OUTPUT_HIGH 0x30
192 #define TEMPLOG7_IO_CFG_IO2_SEL_MASK 0x30
193 #define TEMPLOG7_IO_CFG_IO1_SEL_INPUT 0x00
194 #define TEMPLOG7_IO_CFG_IO1_SEL_OUTPUT_LOW 0x08
195 #define TEMPLOG7_IO_CFG_IO1_SEL_OUTPUT_HIGH 0x0C
196 #define TEMPLOG7_IO_CFG_IO1_SEL_MASK 0x0C
197 #define TEMPLOG7_IO_CFG_IO0_SEL_INPUT 0x00
198 #define TEMPLOG7_IO_CFG_IO0_SEL_OUTPUT_LOW 0x02
199 #define TEMPLOG7_IO_CFG_IO0_SEL_OUTPUT_HIGH 0x03
200 #define TEMPLOG7_IO_CFG_IO0_SEL_MASK 0x03
201 #define TEMPLOG7_IO_CHECK_CODE_OK 0xAA
207 #define TEMPLOG7_EEPROM_ADDR_MIN 0x00
208 #define TEMPLOG7_EEPROM_ADDR_MAX 0xFF
209 #define TEMPLOG7_EEPROM_ADDR_BLOCK 8
210 #define TEMPLOG7_EEPROM_ADDR_MASK 0xFFF8u
216 #define TEMPLOG7_COPY_SCRATCHPAD_2_QUALIFIER 0xA5
222 #define TEMPLOG7_FAMILY_CODE 0x26
228 #define TEMPLOG7_ADDRESS_0 0x00
229 #define TEMPLOG7_ADDRESS_ALL 0xFF
247 #define TEMPLOG7_MAP_MIKROBUS( cfg, mikrobus ) \
248 cfg.gp0 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
249 cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
250 cfg.alert = MIKROBUS( mikrobus, MIKROBUS_INT );
pin_name_t alert
Definition: templog7.h:322
err_t templog7_select_device(templog7_t *ctx)
Temp-Log 7 select device function.
@ TEMPLOG7_OK
Definition: templog7.h:334
err_t templog7_check_communication(templog7_t *ctx)
Temp-Log 7 check communication function.
one_wire_rom_address_t rom_addr
Definition: templog7.h:306
err_t templog7_read_gpio(templog7_t *ctx, uint8_t *data_out)
Temp-Log 7 read gpio function.
err_t templog7_read_eeprom(templog7_t *ctx, uint16_t address, uint8_t *data_out, uint16_t len)
Temp-Log 7 read EEPROM function.
pin_name_t gp0
Definition: templog7.h:318
err_t templog7_default_cfg(templog7_t *ctx)
Temp-Log 7 default configuration function.
@ TEMPLOG7_ERROR
Definition: templog7.h:335
err_t templog7_read_temperature(templog7_t *ctx, float *temperature)
Temp-Log 7 read temperature function.
uint16_t address
Definition: templog7.h:289
@ TEMPLOG7_GPIO_0
Definition: templog7.h:261
void templog7_cfg_setup(templog7_cfg_t *cfg)
Temp-Log 7 configuration object setup function.
err_t templog7_write_gpio(templog7_t *ctx, uint8_t data_in)
Temp-Log 7 write gpio function.
#define TEMPLOG7_EEPROM_ADDR_BLOCK
Definition: templog7.h:209
templog7_gpio_sel_t
Temp-Log 7 Click gpio selector.
Definition: templog7.h:260
pin_name_t gp1
Definition: templog7.h:319
uint8_t status
Definition: templog7.h:273
err_t templog7_start_measurement(templog7_t *ctx)
Temp-Log 7 start measurement function.
int16_t temp_limit_low
Definition: templog7.h:277
int16_t temperature
Definition: templog7.h:272
err_t templog7_clear_eeprom(templog7_t *ctx)
Temp-Log 7 clear EEPROM function.
err_t templog7_copy_scratchpad_2(templog7_t *ctx)
Temp-Log 7 copy scratchpad 2 function.
templog7_gpio_sel_t gpio_sel
Definition: templog7.h:324
err_t templog7_write_scratchpad_2(templog7_t *ctx, templog7_scratchpad_2_t *scratchpad)
Temp-Log 7 write scratchpad 2 function.
uint8_t config_1
Definition: templog7.h:274
err_t templog7_init(templog7_t *ctx, templog7_cfg_t *cfg)
Temp-Log 7 initialization function.
Temp-Log 7 scratchpad 1 object.
Definition: templog7.h:271
uint8_t templog7_get_alert_pin(templog7_t *ctx)
Temp-Log 7 get alert pin function.
Temp-Log 7 Click context object.
Definition: templog7.h:299
digital_in_t alert
Definition: templog7.h:301
int16_t temp_offset
Definition: templog7.h:279
uint8_t short_addr
Definition: templog7.h:276
int16_t temp_limit_high
Definition: templog7.h:278
templog7_return_value_t
Temp-Log 7 Click return value data.
Definition: templog7.h:333
void templog7_gpio_selection(templog7_cfg_t *cfg, templog7_gpio_sel_t gpio_sel)
Temp-Log 7 driver interface setup function.
err_t templog7_write_eeprom(templog7_t *ctx, uint16_t address, uint8_t *data_in, uint16_t len)
Temp-Log 7 write EEPROM function.
err_t templog7_read_scratchpad_2(templog7_t *ctx, templog7_scratchpad_2_t *scratchpad)
Temp-Log 7 read scratchpad 2 function.
err_t templog7_read_scratchpad_1(templog7_t *ctx, templog7_scratchpad_1_t *scratchpad)
Temp-Log 7 read scratchpad 1 function.
@ TEMPLOG7_GPIO_1
Definition: templog7.h:262
uint8_t address
Definition: templog7.h:307
one_wire_t ow
Definition: templog7.h:304
uint8_t config_2
Definition: templog7.h:275
Temp-Log 7 scratchpad 2 object.
Definition: templog7.h:288
err_t templog7_copy_scratchpad_1(templog7_t *ctx)
Temp-Log 7 copy scratchpad 1 function.
err_t templog7_write_scratchpad_1(templog7_t *ctx, templog7_scratchpad_1_t *scratchpad)
Temp-Log 7 write scratchpad 1 function.
Temp-Log 7 Click configuration object.
Definition: templog7.h:316