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"
55#include "drv_spi_master.h"
69#define ALTITUDE2_MAP_MIKROBUS( cfg, mikrobus ) \
70 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
71 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
72 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
73 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
74 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
75 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
83#define ALTITUDE2_MASTER_I2C 0
84#define ALTITUDE2_MASTER_SPI 1
92#define ALTITUDE2_ERROR -1
99#define ALTITUDE2_DEVICE_ADDR_0 0x76
100#define ALTITUDE2_DEVICE_ADDR_1 0x77
107#define ALTITUDE2_RATIO_256 0x00
108#define ALTITUDE2_RATIO_512 0x01
109#define ALTITUDE2_RATIO_1024 0x02
110#define ALTITUDE2_RATIO_2048 0x03
111#define ALTITUDE2_RATIO_4096 0x04
118#define ALTITUDE2_MANUFACTURER_RESERVED 0x00
119#define ALTITUDE2_C1_SENS 0x01
120#define ALTITUDE2_C2_OFF 0x02
121#define ALTITUDE2_C3_TCS 0x03
122#define ALTITUDE2_C4_TCO 0x04
123#define ALTITUDE2_C5_TREF 0x05
124#define ALTITUDE2_C6_TEMPSENS 0x06
125#define ALTITUDE2_CRC 0x07
uint8_t altitude2_read_prom(altitude2_t *ctx, uint8_t select_data, uint16_t *data_out)
Calibration data read function.
uint8_t altitude2_set_ratio(altitude2_t *ctx, uint8_t temp_ratio, uint8_t press_ratio)
Set ratio function.
void altitude2_read_data(altitude2_t *ctx, float *temp_data, float *press_data, float *altitude_data)
Data read function.
void altitude2_reset(altitude2_t *ctx)
Reset function.
void altitude2_cfg_setup(altitude2_cfg_t *cfg)
Config Object Initialization function.
err_t altitude2_init(altitude2_t *ctx, altitude2_cfg_t *cfg)
Initialization function.
struct altitude2_s altitude2_t
Click ctx object definition.
uint8_t altitude2_select_t
Communication type.
Definition altitude2.h:138
void(* altitude2_master_out_t)(struct altitude2_s *, uint8_t, uint8_t *, uint8_t)
Definition altitude2.h:144
void(* altitude2_master_in_t)(struct altitude2_s *, uint8_t)
Master Input/Output type.
Definition altitude2.h:143
Click configuration structure definition.
Definition altitude2.h:173
uint32_t i2c_speed
Definition altitude2.h:183
altitude2_select_t sel
Definition altitude2.h:189
spi_master_chip_select_polarity_t cs_polarity
Definition altitude2.h:187
pin_name_t sck
Definition altitude2.h:179
spi_master_mode_t spi_mode
Definition altitude2.h:186
pin_name_t mosi
Definition altitude2.h:178
uint32_t spi_speed
Definition altitude2.h:185
pin_name_t scl
Definition altitude2.h:175
pin_name_t miso
Definition altitude2.h:177
pin_name_t sda
Definition altitude2.h:176
pin_name_t cs
Definition altitude2.h:180
uint8_t i2c_address
Definition altitude2.h:184
Click ctx object definition.
Definition altitude2.h:150
altitude2_master_out_t send_comm_resp_f
Definition altitude2.h:159
spi_master_t spi
Definition altitude2.h:153
altitude2_select_t master_sel
Definition altitude2.h:160
uint8_t select_driver
Definition altitude2.h:162
altitude2_master_in_t send_comm_f
Definition altitude2.h:158
i2c_master_t i2c
Definition altitude2.h:152
uint8_t ratio_temp
Definition altitude2.h:163
uint8_t slave_address
Definition altitude2.h:156
pin_name_t chip_select
Definition altitude2.h:157
uint8_t ratio_press
Definition altitude2.h:164
uint16_t data_prom[6]
Definition altitude2.h:165