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"
68#define PRESSURE4_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
70 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
71 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
72 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
73 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
74 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
81#define PRESSURE4_MASTER_I2C 0
82#define PRESSURE4_MASTER_SPI 1
90#define PRESSURE4_ERROR -1
97#define PRESSURE4_ADDR0 0x76
98#define PRESSURE4_ADDR1 0x77
99#define PRESSURE4_ID 0xD0
100#define PRESSURE4_RESET 0xE0
101#define PRESSURE4_STATUS 0xF3
102#define PRESSURE4_CTL_MEAS 0xF4
103#define PRESSURE4_CONFIG 0xF5
104#define PRESSURE4_PRESS_MSB 0xF7
105#define PRESSURE4_PRESS_LSB 0xF8
106#define PRESSURE4_PRESS_XLSB 0xF9
107#define PRESSURE4_TEMP_MSB 0xFA
108#define PRESSURE4_TEMP_LSB 0xFB
109#define PRESSURE4_TEMP_XLSB 0xFC
116#define PRESSURE4_CALIBRATION_DIG_T1 0x88
117#define PRESSURE4_CALIBRATION_DIG_T2 0x8A
118#define PRESSURE4_CALIBRATION_DIG_T3 0x8C
119#define PRESSURE4_CALIBRATION_DIG_P1 0x8E
120#define PRESSURE4_CALIBRATION_DIG_P2 0x90
121#define PRESSURE4_CALIBRATION_DIG_P3 0x92
122#define PRESSURE4_CALIBRATION_DIG_P4 0x94
123#define PRESSURE4_CALIBRATION_DIG_P5 0x96
124#define PRESSURE4_CALIBRATION_DIG_P6 0x98
125#define PRESSURE4_CALIBRATION_DIG_P7 0x9A
126#define PRESSURE4_CALIBRATION_DIG_P8 0x9C
127#define PRESSURE4_CALIBRATION_DIG_P9 0x9E
float pressure4_get_pressure(pressure4_t *ctx)
Get pressure function.
void pressure4_write_reg_8_bit(pressure4_t *ctx, uint8_t w_reg, uint8_t w_data)
8 bit writing function.
err_t pressure4_init(pressure4_t *ctx, pressure4_cfg_t *cfg)
Initialization function.
uint8_t pressure4_read_id(pressure4_t *ctx)
Read ID function.
uint8_t pressure4_get_status(pressure4_t *ctx)
Get status function.
void pressure4_generic_write(pressure4_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
float pressure4_get_temperature(pressure4_t *ctx)
Get temperature function.
void pressure4_generic_read(pressure4_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint8_t pressure4_read_reg_8_bit(pressure4_t *ctx, uint8_t r_reg)
8 bit reading function.
void pressure4_cfg_setup(pressure4_cfg_t *cfg)
Config Object Initialization function.
void pressure4_default_cfg(pressure4_t *ctx)
Click Default Configuration function.
void(* pressure4_master_io_t)(struct pressure4_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition pressure4.h:140
struct pressure4_s pressure4_t
Click ctx object definition.
Click configuration structure definition.
Definition pressure4.h:185
uint32_t i2c_speed
Definition pressure4.h:195
spi_master_chip_select_polarity_t cs_polarity
Definition pressure4.h:200
pin_name_t sck
Definition pressure4.h:191
spi_master_mode_t spi_mode
Definition pressure4.h:199
pin_name_t mosi
Definition pressure4.h:190
uint32_t spi_speed
Definition pressure4.h:198
uint8_t sel
Definition pressure4.h:202
pin_name_t scl
Definition pressure4.h:187
pin_name_t miso
Definition pressure4.h:189
pin_name_t sda
Definition pressure4.h:188
pin_name_t cs
Definition pressure4.h:192
uint8_t i2c_address
Definition pressure4.h:196
Click ctx object definition.
Definition pressure4.h:146
digital_out_t cs
Definition pressure4.h:148
int16_t dig_p5
Definition pressure4.h:169
float t1_calc_1
Definition pressure4.h:176
int16_t dig_p4
Definition pressure4.h:168
spi_master_t spi
Definition pressure4.h:152
int16_t dig_p6
Definition pressure4.h:170
int16_t dig_p9
Definition pressure4.h:173
int16_t dig_p8
Definition pressure4.h:172
int16_t dig_t3
Definition pressure4.h:163
int16_t dig_t2
Definition pressure4.h:162
float p3_calc_1
Definition pressure4.h:177
uint8_t master_sel
Definition pressure4.h:159
int16_t dig_p3
Definition pressure4.h:167
int16_t dig_p2
Definition pressure4.h:166
i2c_master_t i2c
Definition pressure4.h:151
int16_t dig_p7
Definition pressure4.h:171
pressure4_master_io_t read_f
Definition pressure4.h:158
int32_t t_fine
Definition pressure4.h:175
pressure4_master_io_t write_f
Definition pressure4.h:157
uint16_t dig_p1
Definition pressure4.h:165
uint8_t slave_address
Definition pressure4.h:155
uint16_t dig_t1
Definition pressure4.h:161
pin_name_t chip_select
Definition pressure4.h:156