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"
73#define DIFFPRESS4_REG_COMMAND 0x22
74#define DIFFPRESS4_REG_TEMPERATURE 0x2E
75#define DIFFPRESS4_REG_PRESSURE 0x30
76#define DIFFPRESS4_REG_STATUS_SYNC 0x32
77#define DIFFPRESS4_REG_STATUS 0x36
78#define DIFFPRESS4_REG_SER0 0x50
79#define DIFFPRESS4_REG_SER1 0x52
97#define DIFFPRESS4_P_MIN -250.0f
98#define DIFFPRESS4_P_MAX 250.0f
99#define DIFFPRESS4_OUT_MIN -26215.0f
100#define DIFFPRESS4_OUT_MAX 26214.0f
101#define DIFFPRESS4_B_0 -16881.0f
102#define DIFFPRESS4_B_1 397.2f
108#define DIFFPRESS4_STATUS_IDLE_CHIP_BUSY 0x00
109#define DIFFPRESS4_STATUS_IDLE_CHIP_IDLE 0x01
110#define DIFFPRESS4_STATUS_DSP_S_CLEARED 0x00
111#define DIFFPRESS4_STATUS_DSP_S_UPDATED 0x01
112#define DIFFPRESS4_STATUS_DSP_T_CLEARED 0x00
113#define DIFFPRESS4_STATUS_DSP_T_UPDATED 0x01
114#define DIFFPRESS4_STATUS_BS_FAIL_NO_FAILURE 0x00
115#define DIFFPRESS4_STATUS_BS_FAIL_OCCURRED 0x01
116#define DIFFPRESS4_STATUS_BC_FAIL_NO_FAILURE 0x00
117#define DIFFPRESS4_STATUS_BC_FAIL_OCCURRED 0x01
118#define DIFFPRESS4_STATUS_DSP_SAT_NORMAL 0x00
119#define DIFFPRESS4_STATUS_DSP_SAT_OVERFLOW 0x01
120#define DIFFPRESS4_STATUS_COM_CRC_OK 0x00
121#define DIFFPRESS4_STATUS_COM_CRC_ERROR 0x01
122#define DIFFPRESS4_STATUS_DSP_S_MISSED 0x00
123#define DIFFPRESS4_STATUS_DSP_S_M_UPDATED 0x01
124#define DIFFPRESS4_STATUS_DSP_T_MISSED 0x00
125#define DIFFPRESS4_STATUS_DSP_T_M_UPDATED 0x01
131#define DIFFPRESS4_SET_CMD_SLEEP_MODE 0x32, 0x6C
132#define DIFFPRESS4_SET_CMD_RESET 0x69, 0xB1
139#define DIFFPRESS4_DEVICE_ADDRESS_UNPROTECTED 0x6C
140#define DIFFPRESS4_DEVICE_ADDRESS_CRC_PROTECTED 0x6D
158#define DIFFPRESS4_MAP_MIKROBUS( cfg, mikrobus ) \
159 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
160 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
diffpress4_return_value_t
Diff Press 4 Click return value data.
Definition diffpress4.h:217
@ DIFFPRESS4_ERROR
Definition diffpress4.h:219
@ DIFFPRESS4_OK
Definition diffpress4.h:218
err_t diffpress4_generic_read(diffpress4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Diff Press 4 I2C reading function.
err_t diffpress4_generic_write(diffpress4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Diff Press 4 I2C writing function.
err_t diffpress4_get_measurement_data(diffpress4_t *ctx, float *diff_press, float *temperature)
Diff Press 4 gets the raw data function.
err_t diffpress4_set_sleep_mode(diffpress4_t *ctx)
Diff Press 4 set sleep mode function.
err_t diffpress4_init(diffpress4_t *ctx, diffpress4_cfg_t *cfg)
Diff Press 4 initialization function.
err_t diffpress4_set_slave_address(diffpress4_t *ctx, uint8_t slave_address)
Diff Press 4 set I2C Slave address function.
err_t diffpress4_get_raw_data(diffpress4_t *ctx, int16_t *temp_data, int16_t *press_data)
Diff Press 4 gets the raw data function.
void diffpress4_cfg_setup(diffpress4_cfg_t *cfg)
Diff Press 4 configuration object setup function.
err_t diffpress4_sw_reset(diffpress4_t *ctx)
Diff Press 4 software reset function.
err_t diffpress4_get_serial_number(diffpress4_t *ctx, uint32_t *serial_number)
Diff Press 4 get serial number function.
err_t diffpress4_get_status(diffpress4_t *ctx, diffpress4_status_t *status)
Diff Press 4 get status function.
Diff Press 4 Click configuration object.
Definition diffpress4.h:184
uint32_t i2c_speed
Definition diffpress4.h:188
pin_name_t scl
Definition diffpress4.h:185
pin_name_t sda
Definition diffpress4.h:186
uint8_t i2c_address
Definition diffpress4.h:189
Diff Press 4 Click status object.
Definition diffpress4.h:198
uint8_t dsp_s_up
Definition diffpress4.h:200
uint8_t bc_fail
Definition diffpress4.h:203
uint8_t dsp_t_up
Definition diffpress4.h:201
uint8_t dsp_s_missed
Definition diffpress4.h:207
uint8_t dsp_sat
Definition diffpress4.h:204
uint8_t bs_fail
Definition diffpress4.h:202
uint8_t dsp_t_missed
Definition diffpress4.h:208
uint8_t com_crc_error
Definition diffpress4.h:206
uint8_t idle
Definition diffpress4.h:199
Diff Press 4 Click context object.
Definition diffpress4.h:170
i2c_master_t i2c
Definition diffpress4.h:172
uint8_t slave_address
Definition diffpress4.h:175