Go to the documentation of this file.
42 #ifdef PREINIT_SUPPORTED
46 #ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52 #include "drv_digital_out.h"
53 #include "drv_i2c_master.h"
54 #include "drv_spi_master.h"
67 #define THERMO9_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
71 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
72 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
73 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
80 #define THERMO9_MASTER_I2C 0
81 #define THERMO9_MASTER_SPI 1
88 #define THERMO9_RETVAL uint8_t
90 #define THERMO9_OK 0x00
91 #define THERMO9_INIT_ERROR 0xFF
97 #define THERMO9_ADDR_VCC 0x76
98 #define THERMO9_ADDR_GND 0x77
105 #define THERMO9_DUMMY_BYTE 0x00
106 #define THERMO9_RESET_CMD 0x1E
107 #define THERMO9_START_ADC_TEMP_CONV 0x48
108 #define THERMO9_READ_ADC_TEMP_RES 0x00
109 #define THERMO9_PROM_READ_ADR_0 0xA0
110 #define THERMO9_PROM_READ_ADR_1_COEF_K4 0xA2
111 #define THERMO9_PROM_READ_ADR_2_COEF_K3 0xA4
112 #define THERMO9_PROM_READ_ADR_3_COEF_K2 0xA6
113 #define THERMO9_PROM_READ_ADR_4_COEF_K1 0xA8
114 #define THERMO9_PROM_READ_ADR_5_COEF_K0 0xAA
115 #define THERMO9_PROM_READ_ADR_6_SN23_8 0xAC
116 #define THERMO9_PROM_READ_ADR_7_SN7_0_CHECKSUM 0xAE
123 #define THERMO9_COEF_CALC_4_2 -2
124 #define THERMO9_COEF_CALC_3 4
125 #define THERMO9_COEF_CALC_0 -1.5
126 #define THERMO9_CALC_COEF_4 1000000000000000000000.0
127 #define THERMO9_CALC_COEF_3 10000000000000000.0
128 #define THERMO9_CALC_COEF_2 100000000000.0
129 #define THERMO9_CALC_COEF_1 1000000.0
130 #define THERMO9_CALC_COEF_0 100.0
131 #define THERMO9_RES_MOD 256.0
310 #endif // _THERMO9_H_
pin_name_t chip_select
Definition: thermo9.h:181
pin_name_t scl
Definition: thermo9.h:199
spi_master_chip_select_polarity_t cs_polarity
Definition: thermo9.h:213
Temperature calibration coefficient.
Definition: thermo9.h:155
spi_master_t spi
Definition: thermo9.h:176
pin_name_t sda
Definition: thermo9.h:200
void(* thermo9_master_io_t)(struct thermo9_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition: thermo9.h:149
thermo9_master_io_t read_f
Definition: thermo9.h:183
uint16_t coef1
Definition: thermo9.h:157
Click ctx object definition.
Definition: thermo9.h:168
uint8_t i2c_address
Definition: thermo9.h:209
float thermo9_read_temp(thermo9_t *ctx)
Read temperature function.
Click configuration structure definition.
Definition: thermo9.h:196
pin_name_t sck
Definition: thermo9.h:203
void thermo9_cfg_setup(thermo9_cfg_t *cfg)
Config Object Initialization function.
pin_name_t miso
Definition: thermo9.h:201
void thermo9_calibation(thermo9_t *ctx)
Calibration function.
digital_out_t cs
Definition: thermo9.h:171
uint16_t coef0
Definition: thermo9.h:156
thermo9_select_t sel
Definition: thermo9.h:215
uint32_t i2c_speed
Definition: thermo9.h:208
void thermo9_generic_read(thermo9_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint16_t coef4
Definition: thermo9.h:160
void thermo9_send_cmd(thermo9_t *ctx, uint8_t cmd_byte)
Send command function.
uint16_t coef3
Definition: thermo9.h:159
thermo9_master_io_t write_f
Definition: thermo9.h:182
pin_name_t cs
Definition: thermo9.h:204
uint8_t slave_address
Definition: thermo9.h:180
uint16_t coef2
Definition: thermo9.h:158
void thermo9_generic_write(thermo9_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
thermo9_temp_coef_t temp_coef
Definition: thermo9.h:188
i2c_master_t i2c
Definition: thermo9.h:175
spi_master_mode_t spi_mode
Definition: thermo9.h:212
struct thermo9_s thermo9_t
Click ctx object definition.
thermo9_select_t master_sel
Definition: thermo9.h:184
pin_name_t mosi
Definition: thermo9.h:202
uint32_t spi_speed
Definition: thermo9.h:211
uint8_t thermo9_select_t
Communication type.
Definition: thermo9.h:144
#define THERMO9_RETVAL
Definition: thermo9.h:88
THERMO9_RETVAL thermo9_init(thermo9_t *ctx, thermo9_cfg_t *cfg)
Initialization function.