39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_in.h"
50#include "drv_i2c_master.h"
72#define THERMO28_REG_TVAL 0x00
73#define THERMO28_REG_CONFIG 0x01
74#define THERMO28_REG_TLOW 0x02
75#define THERMO28_REG_THIGH 0x03
93#define THERMO28_CFG_DEFAULT_CONFIG 0x40A0
94#define THERMO28_CFG_SINGLE_SHOT 0x8000
95#define THERMO28_CONV_RATE_BIT_MASK 0x00C0
96#define THERMO28_STATE_BIT_MASK 0x0100
97#define THERMO28_CONSEC_FAULTS_BIT_MASK 0x3000
98#define THERMO28_ALERT_BIT_MASK 0x0200
99#define THERMO28_SINGLE_SHOT_BIT_MASK 0x8000
106#define THERMO28_DEVICE_ADDRESS_VSS 0x48
107#define THERMO28_DEVICE_ADDRESS_VDD 0x49
108#define THERMO28_DEVICE_ADDRESS_SDA 0x4A
109#define THERMO28_DEVICE_ADDRESS_SCL 0x4B
127#define THERMO28_MAP_MIKROBUS( cfg, mikrobus ) \
128 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
129 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
130 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t thermo28_set_sleep_mode(thermo28_t *ctx)
Thermo 28 set device working mode function.
err_t thermo28_generic_read(thermo28_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Thermo 28 I2C reading function.
uint8_t thermo28_get_int_pin(thermo28_t *ctx)
Thermo 28 set alert status function.
err_t thermo28_set_continuous_conversion(thermo28_t *ctx)
Thermo 28 set continuous conversion function.
err_t thermo28_init(thermo28_t *ctx, thermo28_cfg_t *cfg)
Thermo 28 initialization function.
err_t thermo28_generic_write(thermo28_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Thermo 28 I2C writing function.
err_t thermo28_set_alert_limits(thermo28_t *ctx, float alert_min, float alert_max)
Thermo 28 set alert limits function.
err_t thermo28_set_config(thermo28_t *ctx, thermo28_config_t config)
Thermo 28 set configuration function.
err_t thermo28_get_temperature(thermo28_t *ctx, float *temperature)
Thermo 28 get temperature function.
void thermo28_cfg_setup(thermo28_cfg_t *cfg)
Thermo 28 configuration object setup function.
err_t thermo28_default_cfg(thermo28_t *ctx)
Thermo 28 default configuration function.
err_t thermo28_set_trigger_single_shot(thermo28_t *ctx)
Thermo 28 set trigger single-shot function.
Thermo 28 Click configuration object.
Definition thermo28.h:239
uint32_t i2c_speed
Definition thermo28.h:245
pin_name_t scl
Definition thermo28.h:240
pin_name_t int_pin
Definition thermo28.h:243
pin_name_t sda
Definition thermo28.h:241
uint8_t i2c_address
Definition thermo28.h:246
Thermo 28 Click configuration object.
Definition thermo28.h:255
thermo28_conv_rate_t conv_rate
Definition thermo28.h:256
thermo28_device_mode_t device_mode
Definition thermo28.h:257
thermo28_alert_mode_t alert_mode
Definition thermo28.h:258
thermo28_single_shot_t single_shot
Definition thermo28.h:261
thermo28_alert_polarity_t alert_polarity
Definition thermo28.h:259
thermo28_consec_faults_t consecutive_faults
Definition thermo28.h:260
Thermo 28 Click context object.
Definition thermo28.h:222
digital_in_t int_pin
Definition thermo28.h:224
i2c_master_t i2c
Definition thermo28.h:227
uint8_t slave_address
Definition thermo28.h:230
thermo28_alert_mode_t
Thermo 28 Click interrupt mode value data.
Definition thermo28.h:175
@ THERMO28_ALERT_COMPARATOR
Definition thermo28.h:177
@ THERMO28_ALERT_INTERRUPT
Definition thermo28.h:176
thermo28_device_mode_t
Thermo 28 Click sleep mode value data.
Definition thermo28.h:164
@ THERMO28_STATE_ACTIVE
Definition thermo28.h:166
@ THERMO28_STATE_SLEEP
Definition thermo28.h:165
thermo28_conv_rate_t
Thermo 28 Click conversion rate value data.
Definition thermo28.h:151
@ THERMO28_CONV_RATE8
Definition thermo28.h:155
@ THERMO28_CONV_RATE025
Definition thermo28.h:152
@ THERMO28_CONV_RATE4
Definition thermo28.h:154
@ THERMO28_CONV_RATE1
Definition thermo28.h:153
thermo28_single_shot_t
Thermo 28 Click measurement mode value data.
Definition thermo28.h:211
@ THERMO28_SINGLE_SHOT_NO_CONVERSION
Definition thermo28.h:212
@ THERMO28_SINGLE_SHOT_START_CONVERSION
Definition thermo28.h:213
thermo28_consec_faults_t
Thermo 28 Click consecutive faults value data.
Definition thermo28.h:198
@ THERMO28_CONSEC_FAULTS1
Definition thermo28.h:199
@ THERMO28_CONSEC_FAULTS2
Definition thermo28.h:200
@ THERMO28_CONSEC_FAULTS4
Definition thermo28.h:202
@ THERMO28_CONSEC_FAULTS3
Definition thermo28.h:201
thermo28_alert_polarity_t
Thermo 28 Click polarity of the alert output value data.
Definition thermo28.h:187
@ THERMO28_ALERT_ACTIVE_HIGH
Definition thermo28.h:189
@ THERMO28_ALERT_ACTIVE_LOW
Definition thermo28.h:188
thermo28_return_value_t
Thermo 28 Click return value data.
Definition thermo28.h:140
@ THERMO28_ERROR
Definition thermo28.h:142
@ THERMO28_OK
Definition thermo28.h:141