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 PRESSURE10_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 ); \
75 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT )
82#define PRESSURE10_MASTER_I2C 0
83#define PRESSURE10_MASTER_SPI 1
90#define PRESSURE10_RETVAL uint8_t
92#define PRESSURE10_OK 0x00
93#define PRESSURE10_INIT_ERROR 0xFF
101#define DEVICE_ERROR 1
108#define I2C_COMMUNICATION 1
109#define SPI_COMMUNICATION 0
116#define PRESSURE10_DEVICE_SLAVE_ADDR_0 0x48
117#define PRESSURE10_DEVICE_SLAVE_ADDR_1 0x49
124#define PRESSURE10_REG_WHO_I_AM 0x00
125#define PRESSURE10_REG_INFORMATION 0x01
126#define PRESSURE10_REG_FIFO_STATUS 0x02
127#define PRESSURE10_REG_STATUS 0x03
128#define PRESSURE10_REG_PRESSURE_OUT_LOW 0x04
129#define PRESSURE10_REG_PRESSURE_OUT_MID 0x05
130#define PRESSURE10_REG_PRESSURE_OUT_HIGH 0x06
131#define PRESSURE10_REG_TEMP_OUT_LOW 0x09
132#define PRESSURE10_REG_TEMP_OUT_HIGH 0x0A
133#define PRESSURE10_REG_DRDY_PIN_CRTL 0x0D
134#define PRESSURE10_REG_CONTROL_1 0x0E
135#define PRESSURE10_REG_CONTROL_2 0x0F
136#define PRESSURE10_REG_ACTION_CONTROL_1 0x10
137#define PRESSURE10_REG_ACTION_CONTROL_2 0x11
138#define PRESSURE10_REG_FIFO_CONTROL 0x12
139#define PRESSURE10_REG_AVERAGE_CONTROL 0x13
140#define PRESSURE10_REG_I2C_DISABLE 0x15
141#define PRESSURE10_REG_PRODUCT_NUMBER 0x1C
142#define PRESSURE10_CMD_PRESS_DETECTION 0x20
143#define PRESSURE10_CMD_TEMP_DETECTION 0x22
144#define PRESSURE10_CMD_SW_RESET 0x26
145#define PRESSURE10_CMD_PT_DETECTION 0x29
152#define PRESSURE10_DEF_WHO_I_AM 0x49
153#define PRESSURE10_DEF_INFO 0x31
154#define PRESSURE10_DEF_PRODUCT_NUM 0x40
161#define PRESSURE10_CTRLDRDY_AFEV_ENABLE 0x80
162#define PRESSURE10_CTRLDRDY_AFEV_DISABLE 0x00
163#define PRESSURE10_CTRLDRDY_ATDR_ENABLE 0x10
164#define PRESSURE10_CTRLDRDY_ATDR_DISABLE 0x00
165#define PRESSURE10_CTRLDRDY_APOR_ENABLE 0x04
166#define PRESSURE10_CTRLDRDY_APOR_DISABLE 0x00
167#define PRESSURE10_CTRLDRDY_APDY_ENABLE 0x01
168#define PRESSURE10_CTRLDRDY_APDY_DISABLE 0x00
175#define PRESSURE10_CTRL1_PDRP_LOW_ACTIVE 0x00
176#define PRESSURE10_CTRL1_PDRP_HIGH_ACTIVE 0x10
177#define PRESSURE10_CTRL1_PTAP_ULTRA_LOW_PWR 0x00
178#define PRESSURE10_CTRL1_PTAP_LOW_PWR 0x01
179#define PRESSURE10_CTRL1_PTAP_HIGH_ACCURACY 0x02
180#define PRESSURE10_CTRL1_PTAP_ULTRA_ACCURACY 0x03
187#define PRESSURE10_CTRL2_TMES_DISABLE 0x00
188#define PRESSURE10_CTRL2_TMES_ENABLE 0x80
189#define PRESSURE10_CTRL2_PMES_DISABLE 0x00
190#define PRESSURE10_CTRL2_PMES_ENABLE 0x20
191#define PRESSURE10_CTRL2_ODR_1HZ 0x00
192#define PRESSURE10_CTRL2_ODR_10HZ 0x04
193#define PRESSURE10_CTRL2_ODR_100HZ 0x08
194#define PRESSURE10_CTRL2_ODR_200HZ 0x0C
195#define PRESSURE10_CTRL2_MODE_REG_ACTION 0x00
196#define PRESSURE10_CTRL2_MODE_CONT_MEAS 0x01
197#define PRESSURE10_CTRL2_MODE_CMD_ACTION 0x02
204#define PRESSURE10_ACTRL1_TEMP_NO_MEAS 0x00
205#define PRESSURE10_ACTRL1_TEMP_MEAS 0x08
206#define PRESSURE10_ACTRL1_PRESS_NO_MEAS 0x00
207#define PRESSURE10_ACTRL1_PRESS_MEAS 0x02
214#define PRESSURE10_ACTRL2_SW_RESET_NONE 0x00
215#define PRESSURE10_ACTRL2_SW_RESET_EXECUTE 0x80
222#define PRESSURE10_AVCTRL_TFRQ_ONLY_FIRST_TIME 0x00
223#define PRESSURE10_AVCTRL_TFRQ_ONLY_EVERY_64_TIMES 0x08
224#define PRESSURE10_AVCTRL_TFRQ_ONLY_EVERY_32_TIMES 0x10
225#define PRESSURE10_AVCTRL_TFRQ_ONLY_EVERY_16_TIMES 0x18
226#define PRESSURE10_AVCTRL_TFRQ_ONLY_EVERY_8_TIMES 0x20
227#define PRESSURE10_AVCTRL_TFRQ_ONLY_EVERY_4_TIMES 0x28
228#define PRESSURE10_AVCTRL_TFRQ_ONLY_EVERY_2_TIMES 0x30
229#define PRESSURE10_AVCTRL_TFRQ_EVERY_TIME 0x38
230#define PRESSURE10_AVCTRL_AVG_NONE 0x00
231#define PRESSURE10_AVCTRL_AVG_X2 0x01
232#define PRESSURE10_AVCTRL_AVG_X4 0x02
233#define PRESSURE10_AVCTRL_AVG_X8 0x03
234#define PRESSURE10_AVCTRL_AVG_X16 0x04
235#define PRESSURE10_AVCTRL_AVG_X32 0x05
236#define PRESSURE10_AVCTRL_AVG_X64 0x06
237#define PRESSURE10_AVCTRL_AVG_X128 0x07
#define PRESSURE10_RETVAL
Definition pressure10.h:90
void pressure10_generic_write(pressure10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
uint8_t pressure10_check_communication(pressure10_t *ctx)
Check communication.
float pressure10_get_pressure(pressure10_t *ctx)
Get Pressure data in mBar.
void pressure10_cfg_setup(pressure10_cfg_t *cfg)
Config Object Initialization function.
void pressure10_default_cfg(pressure10_t *ctx)
Click Default Configuration function.
PRESSURE10_RETVAL pressure10_init(pressure10_t *ctx, pressure10_cfg_t *cfg)
Initialization function.
float pressure10_get_temperature(pressure10_t *ctx)
Get Temperature data in C.
void pressure10_control_cfg(pressure10_t *ctx, uint8_t ctrl_reg, uint8_t wr_data)
Set the configuration in the control registers.
void pressure10_send_cmd(pressure10_t *ctx, uint8_t cmd)
Send command.
void pressure10_generic_read(pressure10_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint8_t pressure10_get_drdy_pin(pressure10_t *ctx)
Get DRDY pin state.
void pressure10_get_status(pressure10_t *ctx, pressure10_status_t *status_obj)
Get status function.
uint8_t pressure10_select_t
Communication type.
Definition pressure10.h:259
struct pressure10_s pressure10_t
Click ctx object definition.
void(* pressure10_master_io_t)(struct pressure10_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition pressure10.h:264
Click configuration structure definition.
Definition pressure10.h:298
pressure10_select_t sel
Definition pressure10.h:321
uint32_t i2c_speed
Definition pressure10.h:314
spi_master_chip_select_polarity_t cs_polarity
Definition pressure10.h:319
pin_name_t sck
Definition pressure10.h:305
spi_master_mode_t spi_mode
Definition pressure10.h:318
pin_name_t mosi
Definition pressure10.h:304
uint32_t spi_speed
Definition pressure10.h:317
pin_name_t scl
Definition pressure10.h:301
pin_name_t rdy
Definition pressure10.h:310
pin_name_t miso
Definition pressure10.h:303
pin_name_t sda
Definition pressure10.h:302
pin_name_t cs
Definition pressure10.h:306
uint8_t i2c_address
Definition pressure10.h:315
Click ctx object definition.
Definition pressure10.h:270
digital_out_t cs
Definition pressure10.h:273
pressure10_select_t master_sel
Definition pressure10.h:290
spi_master_t spi
Definition pressure10.h:282
pressure10_master_io_t read_f
Definition pressure10.h:289
pressure10_master_io_t write_f
Definition pressure10.h:288
i2c_master_t i2c
Definition pressure10.h:281
uint8_t slave_address
Definition pressure10.h:286
pin_name_t chip_select
Definition pressure10.h:287
digital_in_t rdy
Definition pressure10.h:277
Definition pressure10.h:248
uint8_t press_meas
Definition pressure10.h:252
uint8_t data_over
Definition pressure10.h:251
uint8_t temp_meas
Definition pressure10.h:250
uint8_t busy
Definition pressure10.h:249