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 PRESSURE16_REG_INT_CFG 0x0B
76#define PRESSURE16_REG_THR_P_L 0x0C
77#define PRESSURE16_REG_THR_P_H 0x0D
78#define PRESSURE16_REG_INTERFACE_CTRL 0x0E
79#define PRESSURE16_REG_DEVICE_ID 0x0F
80#define PRESSURE16_REG_CTRL_1 0x10
81#define PRESSURE16_REG_CTRL_2 0x11
82#define PRESSURE16_REG_CTRL_3 0x12
83#define PRESSURE16_REG_FIFO_CTRL 0x13
84#define PRESSURE16_REG_FIFO_WTM 0x14
85#define PRESSURE16_REG_REF_P_L 0x15
86#define PRESSURE16_REG_REF_P_H 0x16
87#define PRESSURE16_REG_OPC_P_L 0x18
88#define PRESSURE16_REG_OPC_P_H 0x19
89#define PRESSURE16_REG_INT_SOURCE 0x24
90#define PRESSURE16_REG_FIFO_STATUS_1 0x25
91#define PRESSURE16_REG_FIFO_STATUS_2 0x26
92#define PRESSURE16_REG_STATUS 0x27
93#define PRESSURE16_REG_DATA_P_XL 0x28
94#define PRESSURE16_REG_DATA_P_L 0x29
95#define PRESSURE16_REG_DATA_P_H 0x2A
96#define PRESSURE16_REG_DATA_T_L 0x2B
97#define PRESSURE16_REG_DATA_T_H 0x2C
98#define PRESSURE16_REG_FIFO_DATA_P_XL 0x78
99#define PRESSURE16_REG_FIFO_DATA_P_L 0x79
100#define PRESSURE16_REG_FIFO_DATA_P_H 0x7A
101#define PRESSURE16_REG_FIFO_DATA_T_L 0x7B
102#define PRESSURE16_REG_FIFO_DATA_T_H 0x7C
120#define PRESSURE16_SET_CTRL_ODR_POWER_DOWN_MODE 0x00
121#define PRESSURE16_SET_CTRL_ODR_1 0x01
122#define PRESSURE16_SET_CTRL_ODR_10 0x02
123#define PRESSURE16_SET_CTRL_ODR_25 0x03
124#define PRESSURE16_SET_CTRL_ODR_50 0x04
125#define PRESSURE16_SET_CTRL_ODR_75 0x05
126#define PRESSURE16_SET_CTRL_ODR_100 0x06
127#define PRESSURE16_SET_CTRL_ODR_200 0x07
129#define PRESSURE16_SET_CTRL_LPFP_DISABLE 0x00
130#define PRESSURE16_SET_CTRL_LPFP_ENABLE 0x01
132#define PRESSURE16_SET_CTRL_LPFP_DISABLE 0x00
133#define PRESSURE16_SET_CTRL_LPFP_ENABLE 0x01
135#define PRESSURE16_SET_BDU_DATA_UPDATES_CONTINUOUS 0x00
136#define PRESSURE16_SET_BDU_DATA_NOT_UPDATES_UNTIL_READ 0x01
138#define PRESSURE16_SET_SIM_SPI_4_WIRE_INTERFACE 0x00
139#define PRESSURE16_SET_SIM_SPI_3_WIRE_INTERFACE 0x01
141#define PRESSURE16_SET_BOOT_NORMAL_OPERATION 0x00
142#define PRESSURE16_SET_BOOT_REBOOT_MEMORY_CONTENT 0x01
144#define PRESSURE16_SET_INT_H_L_INTERRUPT_ACTIVE_HIGH 0x00
145#define PRESSURE16_SET_INT_H_L_INTERRUPT_ACTIVE_LOW 0x01
147#define PRESSURE16_SET_PP_OD_PUSH_PULL 0x00
148#define PRESSURE16_SET_PP_OD_OPEN_DRAIN 0x01
150#define PRESSURE16_SET_IF_ADD_INC_DISABLED 0x00
151#define PRESSURE16_SET_IF_ADD_INC_ENABLED 0x01
153#define PRESSURE16_SET_LOW_NOISE_ENABLE_LOW_POWER_MODE 0x00
154#define PRESSURE16_SET_LOW_NOISE_ENABLE_LOW_NOISE_MODE 0x01
156#define PRESSURE16_SET_ONE_SHOT_NORMAL_OPERATION 0x00
157#define PRESSURE16_SET_ONE_SHOT_NEW_DATA_SET_IS_ACQUIRED 0x01
159#define PRESSURE16_SET_INT_F_FULL_DISABLED 0x00
160#define PRESSURE16_SET_INT_F_FULL_ENABLED 0x01
162#define PRESSURE16_SET_INT_F_WTM_DISABLED 0x00
163#define PRESSURE16_SET_INT_F_WTM_ENABLED 0x01
165#define PRESSURE16_SET_INT_F_OVR_DISABLED 0x00
166#define PRESSURE16_SET_INT_F_OVR_ENABLED 0x01
168#define PRESSURE16_SET_DRDY_DISABLED 0x00
169#define PRESSURE16_SET_DRDY_ENABLED 0x01
171#define PRESSURE16_SET_INT_S_DATA_SIGNAL 0x00
172#define PRESSURE16_SET_INT_S_PRESSURE_HIGH_EVENT 0x01
173#define PRESSURE16_SET_INT_S_PRESSURE_LOW_EVENT 0x02
174#define PRESSURE16_SET_INT_S_PRESSURE_LOW_HIGH_EVENT 0x03
176#define PRESSURE16_SET_INT_CFG_AUTOREFP_DISABLED 0x00
177#define PRESSURE16_SET_INT_CFG_AUTOREFP_ENABLED 0x01
179#define PRESSURE16_SET_INT_CFG_RESET_ARP_NORMAL_MODE 0x00
180#define PRESSURE16_SET_INT_CFG_RESET_ARP_RST_AUTOREFP 0x01
182#define PRESSURE16_SET_INT_CFG_AUTOZERO_DISABLED 0x00
183#define PRESSURE16_SET_INT_CFG_AUTOZERO_ENABLED 0x01
185#define PRESSURE16_SET_INT_CFG_AUTOZERO_NORMAL_MODE 0x00
186#define PRESSURE16_SET_INT_CFG_RST_AUTOZERO 0x01
188#define PRESSURE16_SET_INT_CFG_DIFF_EN_DISABLED 0x00
189#define PRESSURE16_SET_INT_CFG_DIFF_EN_ENABLED 0x01
191#define PRESSURE16_SET_INT_CFG_LIR_INT_IS_NOT_LATCHED 0x00
192#define PRESSURE16_SET_INT_CFG_LIR_INT_IS_LATCHED 0x01
194#define PRESSURE16_SET_INT_CFG_PLE_INT_IS_INACTIVE 0x00
195#define PRESSURE16_SET_INT_CFG_PLE_INT_IS_ACTIVE 0x01
197#define PRESSURE16_SET_INT_CFG_PHE_INT_IS_INACTIVE 0x00
198#define PRESSURE16_SET_INT_CFG_PHE_INT_IS_ACTIVE 0x01
200#define PRESSURE16_SET_SW_RESET_BIT_MASK 0x04
207#define PRESSURE16_SET_DEV_ADDR_GND 0x5C
208#define PRESSURE16_SET_DEV_ADDR_VCC 0x5D
215#define PRESSURE16_DEVICE_ID 0xB3
233#define PRESSURE16_MAP_MIKROBUS( cfg, mikrobus ) \
234 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
235 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
236 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
237 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
238 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
239 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
240 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t pressure16_get_press_temp(pressure16_t *ctx, float *pressure, float *temperature)
Pressure 16 get pressure and temperature function.
void pressure16_drv_interface_selection(pressure16_cfg_t *cfg, pressure16_drv_t drv_sel)
Pressure 16 driver interface setup function.
err_t pressure16_generic_read(pressure16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Pressure 16 data reading function.
err_t pressure16_default_cfg(pressure16_t *ctx)
Pressure 16 default configuration function.
err_t pressure16_get_ctrl_config(pressure16_t *ctx, pressure16_ctrl_cfg_t *ctrl_cfg_data)
Pressure 16 get control configuration function.
uint8_t pressure16_get_interrupt(pressure16_t *ctx)
Pressure 16 get interrupt function.
err_t pressure16_set_ctrl_config(pressure16_t *ctx, pressure16_ctrl_cfg_t ctrl_cfg_data)
Pressure 16 set control configuration function.
err_t pressure16_get_temperature(pressure16_t *ctx, float *temperature)
Pressure 16 get temperature function.
err_t pressure16_get_interrupt_config(pressure16_t *ctx, pressure16_int_cfg_t *int_cfg_data)
Pressure 16 get interrupt configuration function.
err_t pressure16_get_pressure(pressure16_t *ctx, float *pressure)
Pressure 16 get pressure function.
err_t pressure16_set_interrupt_config(pressure16_t *ctx, pressure16_int_cfg_t int_cfg_data)
Pressure 16 set interrupt configuration function.
err_t pressure16_generic_write(pressure16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Pressure 16 data writing function.
err_t pressure16_init(pressure16_t *ctx, pressure16_cfg_t *cfg)
Pressure 16 initialization function.
err_t pressure16_get_device_id(pressure16_t *ctx, uint8_t *dev_id)
Pressure 16 get device ID function.
err_t pressure16_sw_reset(pressure16_t *ctx)
Pressure 16 software reset function.
void pressure16_cfg_setup(pressure16_cfg_t *cfg)
Pressure 16 configuration object setup function.
pressure16_return_value_t
Pressure 16 Click return value data.
Definition pressure16.h:356
@ PRESSURE16_OK
Definition pressure16.h:357
@ PRESSURE16_ERROR
Definition pressure16.h:358
err_t(* pressure16_master_io_t)(struct pressure16_s *, uint8_t, uint8_t *, uint8_t)
Pressure 16 Click driver interface.
Definition pressure16.h:260
struct pressure16_s pressure16_t
Pressure 16 Click context object.
pressure16_drv_t
Pressure 16 Click driver selector.
Definition pressure16.h:250
@ PRESSURE16_DRV_SEL_I2C
Definition pressure16.h:252
@ PRESSURE16_DRV_SEL_SPI
Definition pressure16.h:251
Pressure 16 Click configuration object.
Definition pressure16.h:287
uint32_t i2c_speed
Definition pressure16.h:296
spi_master_chip_select_polarity_t cs_polarity
Definition pressure16.h:301
pressure16_drv_t drv_sel
Definition pressure16.h:303
pin_name_t sck
Definition pressure16.h:292
spi_master_mode_t spi_mode
Definition pressure16.h:300
pin_name_t mosi
Definition pressure16.h:291
uint32_t spi_speed
Definition pressure16.h:299
pin_name_t scl
Definition pressure16.h:288
pin_name_t int_pin
Definition pressure16.h:294
pin_name_t miso
Definition pressure16.h:290
pin_name_t sda
Definition pressure16.h:289
pin_name_t cs
Definition pressure16.h:293
uint8_t i2c_address
Definition pressure16.h:297
Pressure 16 Click Control configuration object.
Definition pressure16.h:330
uint8_t one_shot
Definition pressure16.h:342
uint8_t bdu
Definition pressure16.h:335
uint8_t pp_od
Definition pressure16.h:339
uint8_t int_h_l
Definition pressure16.h:338
uint8_t sim
Definition pressure16.h:336
uint8_t int_s
Definition pressure16.h:347
uint8_t int_f_ovr
Definition pressure16.h:345
uint8_t if_add_inc
Definition pressure16.h:340
uint8_t drdy
Definition pressure16.h:346
uint8_t lpfp_cfg
Definition pressure16.h:334
uint8_t low_noise_en
Definition pressure16.h:341
uint8_t en_lpfp
Definition pressure16.h:333
uint8_t int_f_full
Definition pressure16.h:343
uint8_t boot
Definition pressure16.h:337
uint8_t odr
Definition pressure16.h:332
uint8_t int_f_wtm
Definition pressure16.h:344
Pressure 16 Click Interrupt configuration object.
Definition pressure16.h:312
uint8_t auto_zero
Definition pressure16.h:316
uint8_t phe
Definition pressure16.h:321
uint8_t lir
Definition pressure16.h:319
uint8_t diff_en
Definition pressure16.h:318
uint8_t auto_refp
Definition pressure16.h:314
uint8_t ple
Definition pressure16.h:320
uint8_t reset_az
Definition pressure16.h:317
uint8_t reset_arp
Definition pressure16.h:315
Pressure 16 Click context object.
Definition pressure16.h:267
pressure16_master_io_t read_f
Definition pressure16.h:278
spi_master_t spi
Definition pressure16.h:271
pressure16_master_io_t write_f
Definition pressure16.h:277
pressure16_drv_t drv_sel
Definition pressure16.h:275
digital_in_t int_pin
Definition pressure16.h:268
i2c_master_t i2c
Definition pressure16.h:270
uint8_t slave_address
Definition pressure16.h:273
pin_name_t chip_select
Definition pressure16.h:274