42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define THERMO7_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
76#define THERMO7_RETVAL uint8_t
78#define THERMO7_OK 0x00
79#define THERMO7_INIT_ERROR 0xFF
86#define THERMO7_REG_AMBIENT_TEMPERATURE 0x00
87#define THERMO7_REG_CONFIGURATION 0x01
88#define THERMO7_REG_HYSTERESIS_TEMPERATURE 0x02
89#define THERMO7_REG_TEMPERATURE_LIMIT_SET 0x03
96#define THERMO7_CONFIG_ONE_SHOT_ENABLE (0x01 << 7)
97#define THERMO7_CONFIG_ONE_SHOT_DISABLE (0x00 << 7)
98#define THERMO7_CONFIG_ADC_RESOLUTION_9bit (0x00 << 5)
99#define THERMO7_CONFIG_ADC_RESOLUTION_10bit (0x01 << 5)
100#define THERMO7_CONFIG_ADC_RESOLUTION_11bit (0x02 << 5)
101#define THERMO7_CONFIG_ADC_RESOLUTION_12bit (0x03 << 5)
102#define THERMO7_CONFIG_FAULT_QUEUE_MODE_1 (0x00 << 3)
103#define THERMO7_CONFIG_FAULT_QUEUE_MODE_2 (0x01 << 3)
104#define THERMO7_CONFIG_FAULT_QUEUE_MODE_4 (0x02 << 3)
105#define THERMO7_CONFIG_FAULT_QUEUE_MODE_6 (0x03 << 3)
106#define THERMO7_CONFIG_ALERT_POLARITY_ACTIVE_HIGH (0x01 << 2)
107#define THERMO7_CONFIG_ALERT_POLARITY_ACTIVE_LOW (0x00 << 2)
108#define THERMO7_CONFIG_COMPARATOR_MODE (0x00 << 1)
109#define THERMO7_CONFIG_INTERRUPT_MODE (0x01 << 1)
110#define THERMO7_CONFIG_SHUTDOWN_ENABLE 0x01
111#define THERMO7_CONFIG_SHUTDOWN_DISABLE 0x00
#define THERMO7_RETVAL
Definition thermo7.h:76
void thermo7_cfg_setup(thermo7_cfg_t *cfg)
Config Object Initialization function.
void thermo7_set_resolution(thermo7_t *ctx, uint8_t resolution)
Functions for settings ADC resolution measurement.
uint8_t thermo7_get_interrupt(thermo7_t *ctx)
Functions for reads state of interrupt pins.
int16_t thermo7_get_limit_temperature(thermo7_t *ctx)
Functions for get Limit Temperature.
void thermo7_set_limit_temperature(thermo7_t *ctx, int16_t temperature)
Functions for settings limit Temperature.
void thermo7_set_configuration(thermo7_t *ctx, uint8_t configuration)
Functions for configuration chip and measurement.
int16_t thermo7_get_hysteresis_temperature(thermo7_t *ctx)
Functions for reads Hysteresis Temperature.
void thermo7_set_hysteresis_temperature(thermo7_t *ctx, int8_t temperature)
Functions for settings Hysteresis Temperature.
void thermo7_generic_write(thermo7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
float thermo7_read_ambient_temperature(thermo7_t *ctx)
Functions for reads ambient temperature.
THERMO7_RETVAL thermo7_init(thermo7_t *ctx, thermo7_cfg_t *cfg)
Initialization function.
void thermo7_generic_read(thermo7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
Click configuration structure definition.
Definition thermo7.h:144
uint32_t i2c_speed
Definition thermo7.h:156
pin_name_t scl
Definition thermo7.h:147
pin_name_t int_pin
Definition thermo7.h:152
pin_name_t sda
Definition thermo7.h:148
uint8_t i2c_address
Definition thermo7.h:157
Click ctx object definition.
Definition thermo7.h:125
digital_in_t int_pin
Definition thermo7.h:128
i2c_master_t i2c
Definition thermo7.h:132
uint8_t slave_address
Definition thermo7.h:136