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_spi_master.h"
70 #define THERMO29_REG_TEMP_RESULT 0x00
71 #define THERMO29_REG_SLEW_RESULT 0x01
72 #define THERMO29_REG_ALERT_STATUS 0x02
73 #define THERMO29_REG_CONFIGURATION 0x03
74 #define THERMO29_REG_ALERT_ENABLE 0x04
75 #define THERMO29_REG_TLOW_LIMIT 0x05
76 #define THERMO29_REG_THIGH_LIMIT 0x06
77 #define THERMO29_REG_HYSTERESIS 0x07
78 #define THERMO29_REG_SLEW_LIMIT 0x08
79 #define THERMO29_REG_UNIQUE_ID1 0x09
80 #define THERMO29_REG_UNIQUE_ID2 0x0A
81 #define THERMO29_REG_UNIQUE_ID3 0x0B
82 #define THERMO29_REG_DEVICE_ID 0x0C
100 #define THERMO29_CONFIGURATION_RESETS 0x0100u
101 #define THERMO29_CONFIGURATION_AVG 0x0080u
102 #define THERMO29_CONFIGURATION_INT_COMP 0x0020u
103 #define THERMO29_CONFIGURATION_ONE_SHOT 0x0010u
104 #define THERMO29_CONFIGURATION_MODE_CONT 0x0000u
105 #define THERMO29_CONFIGURATION_MODE_SHDN 0x0008u
106 #define THERMO29_CONFIGURATION_MODE_MASK 0x0008u
107 #define THERMO29_CONFIGURATION_CONV_PER_6MS 0x0000u
108 #define THERMO29_CONFIGURATION_CONV_PER_31_25MS 0x0001u
109 #define THERMO29_CONFIGURATION_CONV_PER_62_5MS 0x0002u
110 #define THERMO29_CONFIGURATION_CONV_PER_125MS 0x0003u
111 #define THERMO29_CONFIGURATION_CONV_PER_250MS 0x0004u
112 #define THERMO29_CONFIGURATION_CONV_PER_500MS 0x0005u
113 #define THERMO29_CONFIGURATION_CONV_PER_1S 0x0006u
114 #define THERMO29_CONFIGURATION_CONV_PER_2S 0x0007u
115 #define THERMO29_CONFIGURATION_CONV_PER_MASK 0x0007u
121 #define THERMO29_ALERT_ENABLE_CRC 0x0010u
122 #define THERMO29_ALERT_ENABLE_SLEW 0x0008u
123 #define THERMO29_ALERT_ENABLE_THIG 0x0004u
124 #define THERMO29_ALERT_ENABLE_TLOW 0x0002u
125 #define THERMO29_ALERT_ENABLE_DATA_READY 0x0001u
131 #define THERMO29_CRC_ENABLE 0x40
132 #define THERMO29_CRC_DATA_BLOCK_LEN_MASK 0x3C
133 #define THERMO29_AUTO_INCREMENT 0x02
134 #define THERMO29_READ_BIT 0x01
135 #define THERMO29_WRITE_BIT 0x00
136 #define THERMO29_DATA_LEN_MAX 10
142 #define THERMO29_TEMP_RESOLUTION 0.03125f
148 #define THERMO29_DEVICE_REV_MASK 0xF000u
149 #define THERMO29_DEVICE_ID_MASK 0x0FFFu
150 #define THERMO29_DEVICE_ID 0x0126u
160 #define THERMO29_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
161 #define THERMO29_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
179 #define THERMO29_MAP_MIKROBUS( cfg, mikrobus ) \
180 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
181 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
182 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
183 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
184 cfg.alert = MIKROBUS( mikrobus, MIKROBUS_INT )
pin_name_t cs
Definition: thermo29.h:217
pin_name_t miso
Definition: thermo29.h:214
@ THERMO29_OK
Definition: thermo29.h:235
@ THERMO29_ERROR
Definition: thermo29.h:236
This file contains SPI specific macros, functions, etc.
pin_name_t sck
Definition: thermo29.h:216
pin_name_t mosi
Definition: thermo29.h:215
thermo29_return_value_t
Thermo 29 Click return value data.
Definition: thermo29.h:234
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:199
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:212
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:220
spi_master_mode_t spi_mode
Definition: thermo29.h:224
bool crc_enable
Definition: thermo29.h:203
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:196
pin_name_t chip_select
Definition: thermo29.h:201
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:194
uint8_t thermo29_get_alert_pin(thermo29_t *ctx)
Thermo 29 get alert pin function.
uint32_t spi_speed
Definition: thermo29.h:223
spi_master_chip_select_polarity_t cs_polarity
Definition: thermo29.h:225
err_t thermo29_default_cfg(thermo29_t *ctx)
Thermo 29 default configuration function.