Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_one_wire.h"
59 #define THERMO2_CMD_CONVERT_TEMPERATURE 0x44
60 #define THERMO2_CMD_WRITE_SCRATCHPAD 0x4E
61 #define THERMO2_CMD_READ_SCRATCHPAD 0xBE
62 #define THERMO2_CMD_COPY_SCRATCHPAD 0x48
63 #define THERMO2_CMD_RECALL_SCRATCHPAD 0xB8
64 #define THERMO2_CMD_READ_POWER_SUPPLY 0xB4
82 #define THERMO2_CONFIG_ADDRESS_0 0x00
83 #define THERMO2_CONFIG_ADDRESS_1 0x01
84 #define THERMO2_CONFIG_ADDRESS_2 0x02
85 #define THERMO2_CONFIG_ADDRESS_3 0x03
86 #define THERMO2_CONFIG_ADDRESS_4 0x04
87 #define THERMO2_CONFIG_ADDRESS_5 0x05
88 #define THERMO2_CONFIG_ADDRESS_6 0x06
89 #define THERMO2_CONFIG_ADDRESS_7 0x07
90 #define THERMO2_CONFIG_ADDRESS_8 0x08
91 #define THERMO2_CONFIG_ADDRESS_9 0x09
92 #define THERMO2_CONFIG_ADDRESS_10 0x0A
93 #define THERMO2_CONFIG_ADDRESS_11 0x0B
94 #define THERMO2_CONFIG_ADDRESS_12 0x0C
95 #define THERMO2_CONFIG_ADDRESS_13 0x0D
96 #define THERMO2_CONFIG_ADDRESS_14 0x0E
97 #define THERMO2_CONFIG_ADDRESS_15 0x0F
98 #define THERMO2_CONFIG_ADDRESS_ALL 0x10
99 #define THERMO2_CONFIG_ADDRESS_BIT_MASK 0x1F
100 #define THERMO2_CONFIG_RESOLUTION_9BIT 0x00
101 #define THERMO2_CONFIG_RESOLUTION_10BIT 0x20
102 #define THERMO2_CONFIG_RESOLUTION_11BIT 0x40
103 #define THERMO2_CONFIG_RESOLUTION_12BIT 0x60
104 #define THERMO2_CONFIG_RESOLUTION_BIT_MASK 0x60
105 #define THERMO2_CONFIG_RESERVED_BITS 0x10
111 #define THERMO2_DATA_RESOLUTION 0.0625
117 #define THERMO2_FAMILY_CODE 0x3B
123 #define THERMO2_DEFAULT_ADDRESS THERMO2_CONFIG_ADDRESS_ALL
124 #define THERMO2_DEFAULT_RESOLUTION THERMO2_CONFIG_RESOLUTION_12BIT
125 #define THERMO2_DEFAULT_TEMP_HIGH_ALARM 0xFF
126 #define THERMO2_DEFAULT_TEMP_LOW_ALARM 0x00
144 #define THERMO2_MAP_MIKROBUS( cfg, mikrobus ) \
145 cfg.gp0 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
146 cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_AN );
thermo2_gpio_sel_t gpio_sel
Definition: thermo2.h:186
err_t thermo2_start_measurement(thermo2_t *ctx)
Thermo 2 start measurement function.
pin_name_t gp1
Definition: thermo2.h:184
void thermo2_cfg_setup(thermo2_cfg_t *cfg)
Thermo 2 configuration object setup function.
pin_name_t gp0
Definition: thermo2.h:183
err_t thermo2_init(thermo2_t *ctx, thermo2_cfg_t *cfg)
Thermo 2 initialization function.
err_t thermo2_read_scratchpad(thermo2_t *ctx, uint8_t *scratchpad)
Thermo 2 read scratchpad function.
@ THERMO2_ERROR
Definition: thermo2.h:197
Thermo 2 Click configuration object.
Definition: thermo2.h:181
@ THERMO2_GPIO_1
Definition: thermo2.h:158
Thermo 2 Click context object.
Definition: thermo2.h:167
thermo2_gpio_sel_t
Thermo 2 Click gpio selector.
Definition: thermo2.h:156
one_wire_t ow
Definition: thermo2.h:169
err_t thermo2_check_communication(thermo2_t *ctx)
Thermo 2 check communication function.
uint8_t config
Definition: thermo2.h:172
one_wire_rom_address_t rom_addr
Definition: thermo2.h:171
@ THERMO2_GPIO_0
Definition: thermo2.h:157
err_t thermo2_read_temperature(thermo2_t *ctx, float *temperature)
Thermo 2 read temperature function.
thermo2_return_value_t
Thermo 2 Click return value data.
Definition: thermo2.h:195
err_t thermo2_write_scratchpad(thermo2_t *ctx, uint8_t temp_high, uint8_t temp_low, uint8_t config)
Thermo 2 write scratchpad function.
err_t thermo2_select_device(thermo2_t *ctx)
Thermo 2 select device function.
void thermo2_gpio_selection(thermo2_cfg_t *cfg, thermo2_gpio_sel_t gpio_sel)
Thermo 2 driver interface setup function.
err_t thermo2_default_cfg(thermo2_t *ctx)
Thermo 2 default configuration function.
@ THERMO2_OK
Definition: thermo2.h:196