Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_spi_master.h"
60 #define THERMO29_REG_TEMP_RESULT 0x00
61 #define THERMO29_REG_SLEW_RESULT 0x01
62 #define THERMO29_REG_ALERT_STATUS 0x02
63 #define THERMO29_REG_CONFIGURATION 0x03
64 #define THERMO29_REG_ALERT_ENABLE 0x04
65 #define THERMO29_REG_TLOW_LIMIT 0x05
66 #define THERMO29_REG_THIGH_LIMIT 0x06
67 #define THERMO29_REG_HYSTERESIS 0x07
68 #define THERMO29_REG_SLEW_LIMIT 0x08
69 #define THERMO29_REG_UNIQUE_ID1 0x09
70 #define THERMO29_REG_UNIQUE_ID2 0x0A
71 #define THERMO29_REG_UNIQUE_ID3 0x0B
72 #define THERMO29_REG_DEVICE_ID 0x0C
90 #define THERMO29_CONFIGURATION_RESETS 0x0100u
91 #define THERMO29_CONFIGURATION_AVG 0x0080u
92 #define THERMO29_CONFIGURATION_INT_COMP 0x0020u
93 #define THERMO29_CONFIGURATION_ONE_SHOT 0x0010u
94 #define THERMO29_CONFIGURATION_MODE_CONT 0x0000u
95 #define THERMO29_CONFIGURATION_MODE_SHDN 0x0008u
96 #define THERMO29_CONFIGURATION_MODE_MASK 0x0008u
97 #define THERMO29_CONFIGURATION_CONV_PER_6MS 0x0000u
98 #define THERMO29_CONFIGURATION_CONV_PER_31_25MS 0x0001u
99 #define THERMO29_CONFIGURATION_CONV_PER_62_5MS 0x0002u
100 #define THERMO29_CONFIGURATION_CONV_PER_125MS 0x0003u
101 #define THERMO29_CONFIGURATION_CONV_PER_250MS 0x0004u
102 #define THERMO29_CONFIGURATION_CONV_PER_500MS 0x0005u
103 #define THERMO29_CONFIGURATION_CONV_PER_1S 0x0006u
104 #define THERMO29_CONFIGURATION_CONV_PER_2S 0x0007u
105 #define THERMO29_CONFIGURATION_CONV_PER_MASK 0x0007u
111 #define THERMO29_ALERT_ENABLE_CRC 0x0010u
112 #define THERMO29_ALERT_ENABLE_SLEW 0x0008u
113 #define THERMO29_ALERT_ENABLE_THIG 0x0004u
114 #define THERMO29_ALERT_ENABLE_TLOW 0x0002u
115 #define THERMO29_ALERT_ENABLE_DATA_READY 0x0001u
121 #define THERMO29_CRC_ENABLE 0x40
122 #define THERMO29_CRC_DATA_BLOCK_LEN_MASK 0x3C
123 #define THERMO29_AUTO_INCREMENT 0x02
124 #define THERMO29_READ_BIT 0x01
125 #define THERMO29_WRITE_BIT 0x00
126 #define THERMO29_DATA_LEN_MAX 10
132 #define THERMO29_TEMP_RESOLUTION 0.03125f
138 #define THERMO29_DEVICE_REV_MASK 0xF000u
139 #define THERMO29_DEVICE_ID_MASK 0x0FFFu
140 #define THERMO29_DEVICE_ID 0x0126u
150 #define THERMO29_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
151 #define THERMO29_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
169 #define THERMO29_MAP_MIKROBUS( cfg, mikrobus ) \
170 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
171 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
172 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
173 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
174 cfg.alert = MIKROBUS( mikrobus, MIKROBUS_INT )
pin_name_t cs
Definition: thermo29.h:207
pin_name_t miso
Definition: thermo29.h:204
@ THERMO29_OK
Definition: thermo29.h:225
@ THERMO29_ERROR
Definition: thermo29.h:226
This file contains SPI specific macros, functions, etc.
pin_name_t sck
Definition: thermo29.h:206
pin_name_t mosi
Definition: thermo29.h:205
thermo29_return_value_t
Thermo 29 Click return value data.
Definition: thermo29.h:224
void thermo29_disable_crc(thermo29_t *ctx)
Thermo 29 disable crc function.
err_t thermo29_read_temperature(thermo29_t *ctx, float *temperature)
Thermo 29 read temperature function.
spi_master_t spi
Definition: thermo29.h:189
err_t thermo29_init(thermo29_t *ctx, thermo29_cfg_t *cfg)
Thermo 29 initialization function.
err_t thermo29_check_communication(thermo29_t *ctx)
Thermo 29 check communication function.
err_t thermo29_write_register(thermo29_t *ctx, uint8_t reg, uint16_t data_in)
Thermo 29 write register function.
Thermo 29 Click configuration object.
Definition: thermo29.h:202
err_t thermo29_write_registers(thermo29_t *ctx, uint8_t reg, uint16_t *data_in, uint8_t len)
Thermo 29 write registers function.
err_t thermo29_read_register(thermo29_t *ctx, uint8_t reg, uint16_t *data_out)
Thermo 29 read register function.
pin_name_t alert
Definition: thermo29.h:210
spi_master_mode_t spi_mode
Definition: thermo29.h:214
bool crc_enable
Definition: thermo29.h:193
err_t thermo29_clear_alert_status(thermo29_t *ctx)
Thermo 29 clear alert status function.
void thermo29_enable_crc(thermo29_t *ctx)
Thermo 29 enable crc function.
err_t thermo29_read_unique_id(thermo29_t *ctx, uint16_t *unique_id)
Thermo 29 read unique id function.
digital_in_t alert
Definition: thermo29.h:186
pin_name_t chip_select
Definition: thermo29.h:191
err_t thermo29_read_registers(thermo29_t *ctx, uint8_t reg, uint16_t *data_out, uint8_t len)
Thermo 29 read registers function.
void thermo29_cfg_setup(thermo29_cfg_t *cfg)
Thermo 29 configuration object setup function.
Thermo 29 Click context object.
Definition: thermo29.h:184
uint8_t thermo29_get_alert_pin(thermo29_t *ctx)
Thermo 29 get alert pin function.
uint32_t spi_speed
Definition: thermo29.h:213
spi_master_chip_select_polarity_t cs_polarity
Definition: thermo29.h:215
err_t thermo29_default_cfg(thermo29_t *ctx)
Thermo 29 default configuration function.