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_i2c_master.h"
69 #define THERMO18_REG_DEVICE_ID 0x1
70 #define THERMO18_REG_T_H_LIMIT 0x2
71 #define THERMO18_REG_T_L_LIMIT 0x3
72 #define THERMO18_REG_CTRL 0x4
73 #define THERMO18_REG_STATUS 0x5
74 #define THERMO18_REG_DATA_T_L 0x6
75 #define THERMO18_REG_DATA_T_H 0x7
76 #define THERMO18_REG_SOFT_RESET 0xC
94 #define THERMO18_CONTROL_ONESHOT_ENABLED 0x01
95 #define THERMO18_CONTROL_CONTINOUS_ENABLED 0x04
101 #define THERMO18_STATUS_DATA_READY 0x00
102 #define THERMO18_STATUS_DATA_BUSY 0x01
103 #define THERMO18_STATUS_OVERTEMPERATURE 0x02
104 #define THERMO18_STATUS_UNDERTEMPERATURE 0x04
110 #define THERMO18_DEVICE_ID 0xA0
117 #define THERMO18_SET_DEV_ADDR 0x3F
135 #define THERMO18_MAP_MIKROBUS( cfg, mikrobus ) \
136 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
137 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
138 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
pin_name_t int_pin
Definition: thermo18.h:169
err_t thermo18_generic_write(thermo18_t *ctx, uint8_t reg, uint8_t tx_data)
Thermo 18 I2C writing function.
uint8_t i2c_address
Definition: thermo18.h:172
err_t thermo18_default_cfg(thermo18_t *ctx)
Thermo 18 default configuration function.
uint32_t i2c_speed
Definition: thermo18.h:171
@ THERMO18_ERROR
Definition: thermo18.h:183
err_t thermo18_read_temperature(thermo18_t *ctx, float *temperature)
Reads and calculates temperature value.
Thermo 18 Click context object.
Definition: thermo18.h:148
i2c_master_t i2c
Definition: thermo18.h:153
uint8_t thermo18_get_interrupt(thermo18_t *ctx)
Get interrput status.
uint8_t slave_address
Definition: thermo18.h:156
pin_name_t scl
Definition: thermo18.h:166
void thermo18_cfg_setup(thermo18_cfg_t *cfg)
Thermo 18 configuration object setup function.
Thermo 18 Click configuration object.
Definition: thermo18.h:165
@ THERMO18_OK
Definition: thermo18.h:182
pin_name_t sda
Definition: thermo18.h:167
digital_in_t int_pin
Definition: thermo18.h:150
thermo18_return_value_t
Thermo 18 Click return value data.
Definition: thermo18.h:181
err_t thermo18_generic_read(thermo18_t *ctx, uint8_t reg, uint8_t *rx_data)
Thermo 18 I2C reading function.
err_t thermo18_reset(thermo18_t *ctx)
Resets device.
err_t thermo18_set_temperature_threshold(thermo18_t *ctx, uint8_t threshold_reg, float threshold_limit)
Sets temperature threshold.
err_t thermo18_init(thermo18_t *ctx, thermo18_cfg_t *cfg)
Thermo 18 initialization function.