39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
52#include "drv_spi_master.h"
75#define ALTITUDE6_CMD_RESET 0x1E
76#define ALTITUDE6_CMD_CONV_D1_OSR_256 0x40
77#define ALTITUDE6_CMD_CONV_D1_OSR_512 0x42
78#define ALTITUDE6_CMD_CONV_D1_OSR_1024 0x44
79#define ALTITUDE6_CMD_CONV_D1_OSR_2048 0x46
80#define ALTITUDE6_CMD_CONV_D1_OSR_4096 0x48
81#define ALTITUDE6_CMD_CONV_D2_OSR_256 0x50
82#define ALTITUDE6_CMD_CONV_D2_OSR_512 0x52
83#define ALTITUDE6_CMD_CONV_D2_OSR_1024 0x54
84#define ALTITUDE6_CMD_CONV_D2_OSR_2048 0x56
85#define ALTITUDE6_CMD_CONV_D2_OSR_4096 0x58
86#define ALTITUDE6_CMD_ADC_READ 0x00
87#define ALTITUDE6_CMD_PROM_READ_START 0xA0
105#define ALTITUDE6_RATIO_256 0x00
106#define ALTITUDE6_RATIO_512 0x01
107#define ALTITUDE6_RATIO_1024 0x02
108#define ALTITUDE6_RATIO_2048 0x03
109#define ALTITUDE6_RATIO_4096 0x04
116#define ALTITUDE6_SET_DEV_ADDR_1 0x76
117#define ALTITUDE6_SET_DEV_ADDR_0 0x77
127#define ALTITUDE6_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
128#define ALTITUDE6_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
146#define ALTITUDE6_MAP_MIKROBUS( cfg, mikrobus ) \
147 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
148 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
149 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
150 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
151 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
152 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
altitude6_return_value_t
Altitude 6 Click return value data.
Definition altitude6.h:235
@ ALTITUDE6_OK
Definition altitude6.h:236
@ ALTITUDE6_ERROR
Definition altitude6.h:237
err_t(* altitude6_master_io_t)(struct altitude6_s *, uint8_t, uint8_t *, uint8_t)
Altitude 6 Click driver interface.
Definition altitude6.h:172
altitude6_drv_t
Altitude 6 Click driver selector.
Definition altitude6.h:162
@ ALTITUDE6_DRV_SEL_I2C
Definition altitude6.h:164
@ ALTITUDE6_DRV_SEL_SPI
Definition altitude6.h:163
struct altitude6_s altitude6_t
Altitude 6 Click context object.
err_t altitude6_get_raw_data(altitude6_t *ctx, uint32_t *temp_data, uint32_t *press_data)
Altitude 6 get raw data function.
err_t altitude6_get_pressure(altitude6_t *ctx, float *pressure)
Altitude 6 get pressure data function.
err_t altitude6_get_data(altitude6_t *ctx, float *temperature, float *pressure, float *altitude)
Altitude 6 get data function.
void altitude6_cfg_setup(altitude6_cfg_t *cfg)
Altitude 6 configuration object setup function.
err_t altitude6_init(altitude6_t *ctx, altitude6_cfg_t *cfg)
Altitude 6 initialization function.
err_t altitude6_set_ratio(altitude6_t *ctx, uint8_t temp_ratio, uint8_t press_ratio)
Altitude 6 set data ratio function.
err_t altitude6_sw_reset(altitude6_t *ctx)
Altitude 6 software reset function.
void altitude6_drv_interface_selection(altitude6_cfg_t *cfg, altitude6_drv_t drv_sel)
Altitude 6 driver interface setup function.
err_t altitude6_generic_read(altitude6_t *ctx, uint8_t cmd, uint8_t *data_out, uint8_t len)
Altitude 6 data reading function.
err_t altitude6_default_cfg(altitude6_t *ctx)
Altitude 6 default configuration function.
err_t altitude6_get_calibration_data(altitude6_t *ctx)
Altitude 6 get calibration data function.
err_t altitude6_set_command(altitude6_t *ctx, uint8_t cmd)
Altitude 6 set command function.
err_t altitude6_get_temperature(altitude6_t *ctx, float *temperature)
Altitude 6 get temperature data function.
This file contains SPI specific macros, functions, etc.
Altitude 6 Click configuration object.
Definition altitude6.h:209
altitude6_drv_t drv_sel
Definition altitude6.h:224
uint32_t i2c_speed
Definition altitude6.h:217
spi_master_chip_select_polarity_t cs_polarity
Definition altitude6.h:222
pin_name_t sck
Definition altitude6.h:214
spi_master_mode_t spi_mode
Definition altitude6.h:221
float sea_level_pressure
Definition altitude6.h:226
pin_name_t mosi
Definition altitude6.h:213
uint32_t spi_speed
Definition altitude6.h:220
pin_name_t scl
Definition altitude6.h:210
pin_name_t miso
Definition altitude6.h:212
pin_name_t sda
Definition altitude6.h:211
pin_name_t cs
Definition altitude6.h:215
uint8_t i2c_address
Definition altitude6.h:218
Altitude 6 Click context object.
Definition altitude6.h:179
uint16_t press_tcs_c3
Definition altitude6.h:194
spi_master_t spi
Definition altitude6.h:181
altitude6_master_io_t write_f
Definition altitude6.h:187
altitude6_drv_t drv_sel
Definition altitude6.h:185
uint16_t press_sens_c1
Definition altitude6.h:192
float sea_lvl_pressure
Definition altitude6.h:190
altitude6_master_io_t read_f
Definition altitude6.h:188
uint16_t press_tempsens_c6
Definition altitude6.h:197
uint16_t press_tco_c4
Definition altitude6.h:195
i2c_master_t i2c
Definition altitude6.h:180
uint8_t ratio_temp
Definition altitude6.h:199
uint16_t press_tref_c5
Definition altitude6.h:196
uint8_t slave_address
Definition altitude6.h:183
pin_name_t chip_select
Definition altitude6.h:184
uint16_t press_off_c2
Definition altitude6.h:193
uint8_t ratio_press
Definition altitude6.h:200