![]() |
Da Vinci Firmware 1
Firmware for the DaVinci-M rocket avionics board.
|
Sensor driver for BMP3 sensor. More...
#include "bmp3.h"
Go to the source code of this file.
Functions | |
| static int8_t | get_calib_data (struct bmp3_dev *dev) |
| This internal API reads the calibration data from the sensor, parse it then compensates it and store in the device structure. | |
| static void | parse_calib_data (const uint8_t *reg_data, struct bmp3_dev *dev) |
| This internal API is used to parse the calibration data, compensates it and store it in device structure. | |
| static int8_t | get_odr_filter_settings (struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This internal API gets the over sampling, ODR and filter settings from the sensor. | |
| static void | parse_sensor_data (const uint8_t *reg_data, struct bmp3_uncomp_data *uncomp_data) |
| This internal API is used to parse the pressure and temperature data and store it in the bmp3_uncomp_data structure instance. | |
| static int8_t | compensate_data (uint8_t sensor_comp, const struct bmp3_uncomp_data *uncomp_data, struct bmp3_data *comp_data, struct bmp3_calib_data *calib_data) |
| This internal API is used to compensate the pressure or temperature or both the data according to the component selected by the user. | |
| static int8_t | compensate_temperature (int64_t *temperature, const struct bmp3_uncomp_data *uncomp_data, struct bmp3_calib_data *calib_data) |
| This internal API is used to compensate the raw temperature data and return the compensated temperature data in integer data type. | |
| static int8_t | compensate_pressure (uint64_t *pressure, const struct bmp3_uncomp_data *uncomp_data, const struct bmp3_calib_data *calib_data) |
| This internal API is used to compensate the pressure data and return the compensated pressure data in integer data type. | |
| static uint32_t | pow_bmp3 (uint8_t base, uint8_t power) |
| This internal API is used to calculate the power functionality. | |
| static uint8_t | are_settings_changed (uint32_t sub_settings, uint32_t settings) |
| This internal API is used to identify the settings which the user wants to modify in the sensor. | |
| static void | interleave_reg_addr (const uint8_t *reg_addr, uint8_t *temp_buff, const uint8_t *reg_data, uint32_t len) |
| This internal API interleaves the register address between the register data buffer for burst write operation. | |
| static int8_t | set_pwr_ctrl_settings (uint32_t desired_settings, const struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This internal API sets the pressure enable and temperature enable settings of the sensor. | |
| static int8_t | set_odr_filter_settings (uint32_t desired_settings, struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This internal API sets the over sampling, ODR and filter settings of the sensor based on the settings selected by the user. | |
| static int8_t | set_int_ctrl_settings (uint32_t desired_settings, const struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This internal API sets the interrupt control (output mode, level, latch and data ready) settings of the sensor based on the settings selected by the user. | |
| static int8_t | set_advance_settings (uint32_t desired_settings, const struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This internal API sets the advance (i2c_wdt_en, i2c_wdt_sel) settings of the sensor based on the settings selected by the user. | |
| static void | fill_osr_data (uint32_t desired_settings, uint8_t *addr, uint8_t *reg_data, uint8_t *len, const struct bmp3_settings *settings) |
| This internal API fills the register address and register data of the the over sampling settings for burst write operation. | |
| static void | fill_odr_data (uint8_t *addr, uint8_t *reg_data, uint8_t *len, struct bmp3_settings *settings) |
| This internal API fills the register address and register data of the the ODR settings for burst write operation. | |
| static void | fill_filter_data (uint8_t *addr, uint8_t *reg_data, uint8_t *len, const struct bmp3_settings *settings) |
| This internal API fills the register address and register data of the the filter settings for burst write operation. | |
| static int8_t | null_ptr_check (const struct bmp3_dev *dev) |
| This internal API is used to validate the device pointer for null conditions. | |
| static void | parse_sett_data (const uint8_t *reg_data, struct bmp3_settings *settings) |
| This internal API parse the power control(power mode, pressure enable
and temperature enable), over sampling, ODR, filter and interrupt control settings and store in the device structure. | |
| static void | parse_pwr_ctrl_settings (const uint8_t *reg_data, struct bmp3_settings *settings) |
| This internal API parse the power control(power mode, pressure enable
and temperature enable) settings and store in the device structure. | |
| static void | parse_odr_filter_settings (const uint8_t *reg_data, struct bmp3_odr_filter_settings *settings) |
| This internal API parse the over sampling, ODR and filter settings and store in the device structure. | |
| static void | parse_int_ctrl_settings (const uint8_t *reg_data, struct bmp3_int_ctrl_settings *settings) |
| This internal API parse the interrupt control(output mode, level,
latch and data ready) settings and store in the device structure. | |
| static void | parse_advance_settings (const uint8_t *reg_data, struct bmp3_adv_settings *settings) |
| This internal API parse the advance (i2c_wdt_en, i2c_wdt_sel) settings and store in the device structure. | |
| static int8_t | validate_normal_mode_settings (struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This internal API validate the normal mode settings of the sensor. | |
| static int8_t | validate_osr_and_odr_settings (const struct bmp3_settings *settings) |
| This internal API validate the over sampling, ODR settings of the sensor. | |
| static uint32_t | calculate_press_meas_time (const struct bmp3_settings *settings) |
| This internal API calculates the pressure measurement duration of the sensor. | |
| static uint32_t | calculate_temp_meas_time (const struct bmp3_settings *settings) |
| This internal API calculates the temperature measurement duration of the sensor. | |
| static int8_t | verify_meas_time_and_odr_duration (uint32_t meas_t, uint32_t odr_duration) |
| This internal API checks whether the measurement time and ODR duration of the sensor are proper. | |
| static int8_t | put_device_to_sleep (struct bmp3_dev *dev) |
| This internal API puts the device to sleep mode. | |
| static int8_t | set_normal_mode (struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This internal API sets the normal mode in the sensor. | |
| static int8_t | write_power_mode (const struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This internal API writes the power mode in the sensor. | |
| static int8_t | get_sensor_status (struct bmp3_status *status, struct bmp3_dev *dev) |
| This internal API fills the fifo_config_1(fifo_mode,
fifo_stop_on_full, fifo_time_en, fifo_press_en, fifo_temp_en) settings in the reg_data variable so as to burst write in the sensor. | |
| static int8_t | get_int_status (struct bmp3_status *status, struct bmp3_dev *dev) |
| This API gets the interrupt (fifo watermark, fifo full, data ready) status from the sensor. | |
| static int8_t | get_err_status (struct bmp3_status *status, struct bmp3_dev *dev) |
| This API gets the fatal, command and configuration error from the sensor. | |
| int8_t | bmp3_init (struct bmp3_dev *dev) |
| This internal API converts the no. of frames required by the user to bytes so as to write in the watermark length register. | |
| int8_t | bmp3_get_regs (uint8_t reg_addr, uint8_t *reg_data, uint32_t len, struct bmp3_dev *dev) |
| This API reads the data from the given register address of the sensor. | |
| int8_t | bmp3_set_regs (uint8_t *reg_addr, const uint8_t *reg_data, uint32_t len, struct bmp3_dev *dev) |
| This API writes the given data to the register address of the sensor. | |
| int8_t | bmp3_set_sensor_settings (uint32_t desired_settings, struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This API sets the power control(pressure enable and
temperature enable), over sampling, ODR and filter settings in the sensor. | |
| int8_t | bmp3_get_sensor_settings (struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This API gets the power control(power mode, pressure enable and
temperature enable), over sampling, ODR, filter, interrupt control and advance settings from the sensor. | |
| int8_t | bmp3_get_status (struct bmp3_status *status, struct bmp3_dev *dev) |
| This API sets the fifo_config_1(fifo_mode,
fifo_stop_on_full, fifo_time_en, fifo_press_en, fifo_temp_en), fifo_config_2(fifo_subsampling, data_select) and int_ctrl(fwtm_en, ffull_en) settings in the sensor. | |
| int8_t | bmp3_get_fifo_length (uint16_t *fifo_length, struct bmp3_dev *dev) |
| This API gets the fifo length from the sensor. | |
| int8_t | bmp3_soft_reset (struct bmp3_dev *dev) |
| This API performs the soft reset of the sensor. | |
| int8_t | bmp3_fifo_flush (struct bmp3_dev *dev) |
| This API performs the soft reset of the sensor. | |
| int8_t | bmp3_set_op_mode (struct bmp3_settings *settings, struct bmp3_dev *dev) |
| This API sets the power mode of the sensor. | |
| int8_t | bmp3_get_op_mode (uint8_t *op_mode, struct bmp3_dev *dev) |
| This API gets the power mode of the sensor. | |
| int8_t | bmp3_get_sensor_data (uint8_t sensor_comp, struct bmp3_data *comp_data, struct bmp3_dev *dev) |
| This API reads the pressure, temperature or both data from the sensor, compensates the data and store it in the bmp3_data structure instance passed by the user. | |
Sensor driver for BMP3 sensor.
Copyright (c) 2022 Bosch Sensortec GmbH. All rights reserved.
BSD-3-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file bmp3.c.
|
static |
This internal API is used to identify the settings which the user wants to modify in the sensor.
| [in] | sub_settings | : Contains the settings subset to identify particular group of settings which the user is interested to change. |
| [in] | settings | : Contains the user specified settings. |
| True | -> User wants to modify this group of settings |
| False | -> User does not want to modify this group of settings |
Definition at line 2702 of file bmp3.c.
Referenced by bmp3_set_sensor_settings(), and set_odr_filter_settings().

| int8_t bmp3_fifo_flush | ( | struct bmp3_dev * | dev | ) |
This API performs the soft reset of the sensor.
Definition at line 1307 of file bmp3.c.
References BMP3_CMD_RDY, BMP3_E_CMD_EXEC_FAILED, BMP3_FIFO_FLUSH, bmp3_get_regs(), BMP3_OK, BMP3_REG_CMD, BMP3_REG_ERR, BMP3_REG_SENS_STATUS, bmp3_set_regs(), bmp3_dev::delay_us, and bmp3_dev::intf_ptr.

| int8_t bmp3_get_fifo_length | ( | uint16_t * | fifo_length, |
| struct bmp3_dev * | dev | ||
| ) |
This API gets the fifo length from the sensor.
Definition at line 1236 of file bmp3.c.
References BMP3_CONCAT_BYTES, BMP3_E_NULL_PTR, bmp3_get_regs(), BMP3_OK, BMP3_REG_FIFO_LENGTH, and NULL.

| int8_t bmp3_get_op_mode | ( | uint8_t * | op_mode, |
| struct bmp3_dev * | dev | ||
| ) |
This API gets the power mode of the sensor.
Definition at line 1403 of file bmp3.c.
References BMP3_E_NULL_PTR, BMP3_GET_BITS, bmp3_get_regs(), BMP3_REG_PWR_CTRL, and NULL.
Referenced by bmp3_set_op_mode().


| int8_t bmp3_get_regs | ( | uint8_t | reg_addr, |
| uint8_t * | reg_data, | ||
| uint32_t | len, | ||
| struct bmp3_dev * | dev | ||
| ) |
This API reads the data from the given register address of the sensor.
Definition at line 794 of file bmp3.c.
References BMP3_E_COMM_FAIL, BMP3_E_NULL_PTR, BMP3_I2C_INTF, BMP3_INTF_RET_SUCCESS, BMP3_OK, bmp3_dev::dummy_byte, bmp3_dev::intf, bmp3_dev::intf_ptr, bmp3_dev::intf_rslt, NULL, null_ptr_check(), and bmp3_dev::read.
Referenced by bmp3_fifo_flush(), bmp3_get_fifo_length(), bmp3_get_op_mode(), bmp3_get_sensor_data(), bmp3_get_sensor_settings(), bmp3_init(), bmp3_soft_reset(), get_calib_data(), get_err_status(), get_int_status(), get_odr_filter_settings(), get_sensor_status(), put_device_to_sleep(), set_advance_settings(), set_int_ctrl_settings(), set_normal_mode(), set_odr_filter_settings(), set_pwr_ctrl_settings(), and write_power_mode().


| int8_t bmp3_get_sensor_data | ( | uint8_t | sensor_comp, |
| struct bmp3_data * | comp_data, | ||
| struct bmp3_dev * | dev | ||
| ) |
This API reads the pressure, temperature or both data from the sensor, compensates the data and store it in the bmp3_data structure instance passed by the user.
Definition at line 1428 of file bmp3.c.
References BMP3_E_NULL_PTR, bmp3_get_regs(), BMP3_LEN_P_T_DATA, BMP3_OK, BMP3_REG_DATA, bmp3_dev::calib_data, compensate_data(), NULL, and parse_sensor_data().
Referenced by StartSensor_Task().


| int8_t bmp3_get_sensor_settings | ( | struct bmp3_settings * | settings, |
| struct bmp3_dev * | dev | ||
| ) |
This API gets the power control(power mode, pressure enable and temperature enable), over sampling, ODR, filter, interrupt control and advance settings from the sensor.
Definition at line 953 of file bmp3.c.
References BMP3_E_NULL_PTR, bmp3_get_regs(), BMP3_LEN_GEN_SETT, BMP3_OK, BMP3_REG_INT_CTRL, NULL, and parse_sett_data().

| int8_t bmp3_get_status | ( | struct bmp3_status * | status, |
| struct bmp3_dev * | dev | ||
| ) |
This API sets the fifo_config_1(fifo_mode, fifo_stop_on_full, fifo_time_en, fifo_press_en, fifo_temp_en), fifo_config_2(fifo_subsampling, data_select) and int_ctrl(fwtm_en, ffull_en) settings in the sensor.
@brief This API gets the fifo_config_1(fifo_mode, fifo_stop_on_full, fifo_time_en, fifo_press_en, fifo_temp_en), fifo_config_2(fifo_subsampling, data_select) and int_ctrl(fwtm_en, ffull_en) settings from the sensor. ‍/
int8_t bmp3_get_fifo_settings(struct bmp3_fifo_settings *fifo_settings, struct bmp3_dev *dev) { int8_t rslt; uint8_t fifo_sett[3]; uint8_t len = 3;
/* Proceed if null check is fine */ if (fifo_settings != NULL) { rslt = bmp3_get_regs(BMP3_REG_FIFO_CONFIG_1, fifo_sett, len, dev);
/* Parse the fifo settings */ parse_fifo_settings(fifo_sett, fifo_settings); } else { rslt = BMP3_E_NULL_PTR; }
return rslt; }
/*!
This API gets the fifo data from the sensor. / int8_t bmp3_get_fifo_data(struct bmp3_fifo_data *fifo, const struct bmp3_fifo_settings *fifo_settings, struct bmp3_dev *dev) { int8_t rslt; uint16_t fifo_len;
if ((fifo != NULL) && (fifo_settings != NULL)) { reset_fifo_index(fifo);
/* Get the total number of bytes available in FIFO */ rslt = bmp3_get_fifo_length(&fifo_len, dev);
if (rslt == BMP3_OK) { /* For sensor time frame , add additional overhead bytes */ if (fifo_settings->time_en == TRUE) { fifo_len = fifo_len + BMP3_SENSORTIME_OVERHEAD_BYTES; }
/* Update the fifo length in the fifo structure */ fifo->byte_count = fifo_len;
/* Read the fifo data */ rslt = bmp3_get_regs(BMP3_REG_FIFO_DATA, fifo->buffer, fifo_len, dev); } } else { rslt = BMP3_E_NULL_PTR; }
return rslt; }
/*!
This API sets the fifo watermark length according to the frames count set by the user in the device structure. Refer below for usage. / int8_t bmp3_set_fifo_watermark(const struct bmp3_fifo_data *fifo, const struct bmp3_fifo_settings *fifo_settings, struct bmp3_dev *dev) { int8_t rslt; uint8_t reg_data[2]; uint8_t reg_addr[2] = { BMP3_REG_FIFO_WM, BMP3_REG_FIFO_WM + 1 }; uint16_t watermark_len;
if ((fifo != NULL) && (fifo_settings != NULL)) { rslt = convert_frames_to_bytes(&watermark_len, fifo, fifo_settings);
if (rslt == BMP3_OK) { reg_data[0] = BMP3_GET_LSB(watermark_len); reg_data[1] = BMP3_GET_MSB(watermark_len) & 0x01; rslt = bmp3_set_regs(reg_addr, reg_data, 2, dev); } } else { rslt = BMP3_E_NULL_PTR; }
return rslt; }
/*!
This API sets the fifo watermark length according to the frames count set by the user in the device structure. Refer below for usage. / int8_t bmp3_get_fifo_watermark(uint16_t *watermark_len, struct bmp3_dev *dev) { int8_t rslt; uint8_t reg_data[2]; uint8_t reg_addr = BMP3_REG_FIFO_WM;
if (watermark_len != NULL) { rslt = bmp3_get_regs(reg_addr, reg_data, 2, dev); if (rslt == BMP3_OK) { *watermark_len = (reg_data[0]) + (reg_data[1] << 8); } } else { rslt = BMP3_E_NULL_PTR; }
return rslt; }
/*!
This API extracts the temperature and/or pressure data from the FIFO data which is already read from the fifo. / int8_t bmp3_extract_fifo_data(struct bmp3_data *data, struct bmp3_fifo_data *fifo, struct bmp3_dev *dev) { int8_t rslt; uint8_t header; uint8_t parsed_frames = 0; uint8_t t_p_frame; struct bmp3_uncomp_data uncomp_data = { 0 };
rslt = null_ptr_check(dev);
if ((rslt == BMP3_OK) && (fifo != NULL) && (data != NULL)) { uint16_t byte_index = fifo->start_idx;
while (byte_index < fifo->byte_count) { get_header_info(&header, fifo->buffer, &byte_index); t_p_frame = parse_fifo_data_frame(header, fifo, &byte_index, &uncomp_data, &parsed_frames);
/* If the frame is pressure and/or temperature data / if (t_p_frame != FALSE) { / Compensate temperature and pressure data */ rslt = compensate_data(t_p_frame, &uncomp_data, &data[parsed_frames - 1], &dev->calib_data); } }
/* Check if any frames are parsed in FIFO / if (parsed_frames != 0) { / Update the bytes parsed in the device structure / fifo->start_idx = byte_index; fifo->parsed_frames += parsed_frames; } else { / No frames are there to parse. It is time to read the FIFO, if more frames are needed */ fifo->frame_not_available = TRUE; } } else { rslt = BMP3_E_NULL_PTR; }
return rslt; }
/*!
This API gets the command ready, data ready for pressure and temperature and interrupt (fifo watermark, fifo full, data ready) and error status from the sensor.
Definition at line 1204 of file bmp3.c.
References BMP3_E_NULL_PTR, BMP3_OK, get_err_status(), get_int_status(), get_sensor_status(), and NULL.

| int8_t bmp3_init | ( | struct bmp3_dev * | dev | ) |
This internal API converts the no. of frames required by the user to bytes so as to write in the watermark length register.
| [out] | watermark_len | : Pointer variable which contains the watermark length. |
| [in] | fifo | : Structure instance of bmp3_fifo_data |
| [in] | fifo_settings | : Structure instance of bmp3_fifo_settings |
| 0 | -> Success |
| <0 | -> Fail |
This API is the entry point. It performs the selection of I2C/SPI read mechanism according to the selected interface and reads the chip-id and calibration data of the sensor.
Definition at line 738 of file bmp3.c.
References BMP390_CHIP_ID, BMP3_CHIP_ID, BMP3_E_DEV_NOT_FOUND, bmp3_get_regs(), BMP3_I2C_INTF, BMP3_OK, BMP3_REG_CHIP_ID, bmp3_soft_reset(), bmp3_dev::chip_id, bmp3_dev::dummy_byte, get_calib_data(), bmp3_dev::intf, and null_ptr_check().
Referenced by init_bmp390_B(), and init_bmp390_p().


| int8_t bmp3_set_op_mode | ( | struct bmp3_settings * | settings, |
| struct bmp3_dev * | dev | ||
| ) |
This API sets the power mode of the sensor.
Definition at line 1350 of file bmp3.c.
References BMP3_E_NULL_PTR, bmp3_get_op_mode(), BMP3_MODE_FORCED, BMP3_MODE_NORMAL, BMP3_MODE_SLEEP, BMP3_OK, bmp3_dev::delay_us, bmp3_dev::intf_ptr, NULL, null_ptr_check(), bmp3_settings::op_mode, put_device_to_sleep(), set_normal_mode(), and write_power_mode().
Referenced by init_bmp390_B(), and init_bmp390_p().


| int8_t bmp3_set_regs | ( | uint8_t * | reg_addr, |
| const uint8_t * | reg_data, | ||
| uint32_t | len, | ||
| struct bmp3_dev * | dev | ||
| ) |
This API writes the given data to the register address of the sensor.
Definition at line 844 of file bmp3.c.
References BMP3_E_COMM_FAIL, BMP3_E_INVALID_LEN, BMP3_E_NULL_PTR, BMP3_INTF_RET_SUCCESS, BMP3_OK, BMP3_SPI_INTF, interleave_reg_addr(), bmp3_dev::intf, bmp3_dev::intf_ptr, bmp3_dev::intf_rslt, NULL, null_ptr_check(), and bmp3_dev::write.
Referenced by bmp3_fifo_flush(), bmp3_soft_reset(), put_device_to_sleep(), set_advance_settings(), set_int_ctrl_settings(), set_odr_filter_settings(), set_pwr_ctrl_settings(), and write_power_mode().


| int8_t bmp3_set_sensor_settings | ( | uint32_t | desired_settings, |
| struct bmp3_settings * | settings, | ||
| struct bmp3_dev * | dev | ||
| ) |
This API sets the power control(pressure enable and temperature enable), over sampling, ODR and filter settings in the sensor.
Definition at line 909 of file bmp3.c.
References are_settings_changed(), BMP3_ADV_SETT, BMP3_E_NULL_PTR, BMP3_INT_CTRL, BMP3_ODR_FILTER, BMP3_OK, BMP3_POWER_CNTL, NULL, set_advance_settings(), set_int_ctrl_settings(), set_odr_filter_settings(), and set_pwr_ctrl_settings().
Referenced by init_bmp390_B(), and init_bmp390_p().


| int8_t bmp3_soft_reset | ( | struct bmp3_dev * | dev | ) |
This API performs the soft reset of the sensor.
Definition at line 1263 of file bmp3.c.
References BMP3_CMD_RDY, BMP3_E_CMD_EXEC_FAILED, bmp3_get_regs(), BMP3_OK, BMP3_REG_CMD, BMP3_REG_ERR, BMP3_REG_SENS_STATUS, bmp3_set_regs(), BMP3_SOFT_RESET, bmp3_dev::delay_us, and bmp3_dev::intf_ptr.
Referenced by bmp3_init().


|
static |
This internal API calculates the pressure measurement duration of the sensor.
| [out] | settings | : Structure instance of bmp3_settings. |
| Pressure | measurement time in microseconds |
Definition at line 2153 of file bmp3.c.
References BMP3_ADC_CONV_TIME, BMP3_SETTLE_TIME_PRESS, bmp3_settings::odr_filter, pow_bmp3(), and bmp3_odr_filter_settings::press_os.
Referenced by validate_osr_and_odr_settings().


|
static |
This internal API calculates the temperature measurement duration of the sensor.
| [out] | settings | : Structure instance of bmp3_settings. |
| Temperature | measurement time in microseconds |
Definition at line 2176 of file bmp3.c.
References BMP3_ADC_CONV_TIME, BMP3_SETTLE_TIME_TEMP, bmp3_settings::odr_filter, pow_bmp3(), and bmp3_odr_filter_settings::temp_os.
Referenced by validate_osr_and_odr_settings().


|
static |
This internal API is used to compensate the pressure or temperature or both the data according to the component selected by the user.
| [in] | sensor_comp | : Used to select pressure or temperature. |
| [in] | uncomp_data | : Contains the uncompensated pressure and temperature data. |
| [out] | comp_data | : Contains the compensated pressure and temperature data. |
| [in] | calib_data | : Pointer to the calibration data structure. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 2297 of file bmp3.c.
References BMP3_E_NULL_PTR, BMP3_OK, BMP3_PRESS, BMP3_PRESS_TEMP, BMP3_TEMP, compensate_pressure(), compensate_temperature(), NULL, bmp3_data::pressure, and bmp3_data::temperature.
Referenced by bmp3_get_sensor_data().


|
static |
This internal API is used to compensate the pressure data and return the compensated pressure data in integer data type.
This internal API is used to compensate the raw pressure data and return the compensated pressure data in integer data type. for eg return if pressure is 9528709 which is 9528709/100 = 95287.09 Pascal.
| [out] | comp_pressure | : Compensated pressure data in integer. |
| [in] | uncomp_data | : Contains the uncompensated pressure data. |
| [in] | calib_data | : Pointer to the calibration data structure. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 2618 of file bmp3.c.
References BMP3_MAX_PRES_INT, BMP3_MIN_PRES_INT, BMP3_OK, BMP3_W_MAX_PRES, BMP3_W_MIN_PRES, bmp3_reg_calib_data::par_p1, bmp3_reg_calib_data::par_p10, bmp3_reg_calib_data::par_p11, bmp3_reg_calib_data::par_p2, bmp3_reg_calib_data::par_p3, bmp3_reg_calib_data::par_p4, bmp3_reg_calib_data::par_p5, bmp3_reg_calib_data::par_p6, bmp3_reg_calib_data::par_p7, bmp3_reg_calib_data::par_p8, bmp3_reg_calib_data::par_p9, bmp3_uncomp_data::pressure, bmp3_calib_data::reg_calib_data, and bmp3_reg_calib_data::t_lin.
Referenced by compensate_data().

|
static |
This internal API is used to compensate the raw temperature data and return the compensated temperature data in integer data type.
This internal API is used to compensate the raw temperature data and return the compensated temperature data in integer data type. Returns temperature in integer. Actual temperature is obtained by dividing by 100 For eg : If returned temperature is 2426 then it is 2426/100 = 24 deg Celsius.
| [out] | temperature | : Compensated temperature data in integer. |
| [in] | uncomp_data | : Contains the uncompensated temperature data. |
| [in] | calib_data | : Pointer to calibration data structure. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 2572 of file bmp3.c.
References BMP3_MAX_TEMP_INT, BMP3_MIN_TEMP_INT, BMP3_OK, BMP3_W_MAX_TEMP, BMP3_W_MIN_TEMP, bmp3_reg_calib_data::par_t1, bmp3_reg_calib_data::par_t2, bmp3_reg_calib_data::par_t3, bmp3_calib_data::reg_calib_data, bmp3_reg_calib_data::t_lin, and bmp3_uncomp_data::temperature.
Referenced by compensate_data().

|
static |
This internal API fills the register address and register data of the the filter settings for burst write operation.
This internal API fills the register address and register data of the filter settings for burst write operation.
| [out] | addr | : To store the address to fill in register buffer. |
| [out] | reg_data | : To store the register data to set the filter. |
| [out] | len | : To store the len for burst write. |
| [in] | settings | : Structure instance of bmp3_settings |
Definition at line 2257 of file bmp3.c.
References BMP3_REG_CONFIG, BMP3_SET_BITS, bmp3_odr_filter_settings::iir_filter, and bmp3_settings::odr_filter.
Referenced by set_odr_filter_settings().

|
static |
This internal API fills the register address and register data of the the ODR settings for burst write operation.
This internal API fills the register address and register data of the ODR settings for burst write operation.
| [out] | addr | : To store the address to fill in register buffer. |
| [out] | reg_data | : To store the register data to set the odr data. |
| [out] | len | : To store the len for burst write. |
| [in] | settings | : Structure instance of bmp3_settings |
Definition at line 2235 of file bmp3.c.
References BMP3_ODR_0_001_HZ, BMP3_REG_ODR, BMP3_SET_BITS_POS_0, bmp3_odr_filter_settings::odr, and bmp3_settings::odr_filter.
Referenced by set_odr_filter_settings().

|
static |
This internal API fills the register address and register data of the the over sampling settings for burst write operation.
This internal API fills the register address and register data of the over sampling settings for burst write operation.
| [in] | desired_settings | : Variable which specifies the settings which are to be set in the sensor. |
| [out] | addr | : To store the address to fill in register buffer. |
| [out] | reg_data | : To store the osr register data. |
| [out] | len | : To store the len for burst write. |
| [in] | settings | : Structure instance of bmp3_settings |
Definition at line 2199 of file bmp3.c.
References BMP3_REG_OSR, BMP3_SEL_PRESS_OS, BMP3_SEL_TEMP_OS, BMP3_SET_BITS, BMP3_SET_BITS_POS_0, bmp3_settings::odr_filter, bmp3_odr_filter_settings::press_os, and bmp3_odr_filter_settings::temp_os.
Referenced by set_odr_filter_settings().

|
static |
This internal API reads the calibration data from the sensor, parse it then compensates it and store in the device structure.
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 1786 of file bmp3.c.
References bmp3_get_regs(), BMP3_LEN_CALIB_DATA, BMP3_REG_CALIB_DATA, and parse_calib_data().
Referenced by bmp3_init().


|
static |
This API gets the fatal, command and configuration error from the sensor.
| [out] | Structure instance of bmp3_status | |
| [in] | dev | : Structure instance of bmp3_dev |
| 0 | -> Success |
| <0 | -> Fail |
Definition at line 2945 of file bmp3.c.
References BMP3_ERR_CMD, BMP3_ERR_CONF, BMP3_ERR_FATAL, BMP3_GET_BITS, BMP3_GET_BITS_POS_0, bmp3_get_regs(), BMP3_OK, BMP3_REG_ERR, bmp3_err_status::cmd, bmp3_err_status::conf, bmp3_status::err, and bmp3_err_status::fatal.
Referenced by bmp3_get_status().


|
static |
This API gets the interrupt (fifo watermark, fifo full, data ready) status from the sensor.
| [out] | Structure instance of bmp3_status | |
| [in] | dev | : Structure instance of bmp3_dev |
| 0 | -> Success |
| <0 | -> Fail |
Definition at line 2924 of file bmp3.c.
References BMP3_GET_BITS, BMP3_GET_BITS_POS_0, bmp3_get_regs(), BMP3_OK, BMP3_REG_INT_STATUS, bmp3_int_status::drdy, bmp3_int_status::fifo_full, bmp3_int_status::fifo_wm, and bmp3_status::intr.
Referenced by bmp3_get_status().


|
static |
This internal API gets the over sampling, ODR and filter settings from the sensor.
This internal API gets the over sampling, ODR and filter settings of the sensor.
| [in] | settings | : Structure instance of bmp3_settings. |
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 2072 of file bmp3.c.
References bmp3_get_regs(), BMP3_REG_OSR, bmp3_settings::odr_filter, and parse_odr_filter_settings().
Referenced by validate_normal_mode_settings().


|
static |
This internal API fills the fifo_config_1(fifo_mode, fifo_stop_on_full, fifo_time_en, fifo_press_en, fifo_temp_en) settings in the reg_data variable so as to burst write in the sensor.
This internal API is used to parse the fifo_config_1(fifo_mode, fifo_stop_on_full, fifo_time_en, fifo_press_en, fifo_temp_en), fifo_config_2(fifo_subsampling, data_select) and int_ctrl(fwtm_en, ffull_en) settings and store it in device structure.
| [in] | desired_settings | : Variable which specifies the settings which are to be set in the sensor. |
| [in] | fifo_settings | : Structure instance of bmp3_fifo_settings |
| [in] | dev | : Structure instance of bmp3_dev |
@brief This internal API fills the fifo_config_2(fifo_sub_sampling,
data_select) settings in the reg_data variable so as to burst write
in the sensor.
@param[in] desired_settings : Variable which specifies the settings which
are to be set in the sensor.
@param[in] fifo_settings : Structure instance of bmp3_fifo_settings
@param[in] dev : Structure instance of bmp3_dev
‍/
static int8_t fill_fifo_config_2(uint16_t desired_settings, const struct bmp3_fifo_settings *fifo_settings, struct bmp3_dev *dev);
/*!
This internal API fills the fifo interrupt control(fwtm_en, ffull_en) settings in the reg_data variable so as to burst write in the sensor.
| [in] | desired_settings | : Variable which specifies the settings which are to be set in the sensor. |
| [in] | fifo_settings | : Structure instance of bmp3_fifo_settings |
| [in] | dev | : Structure instance of bmp3_dev / static int8_t fill_fifo_int_ctrl(uint16_t desired_settings, const struct bmp3_fifo_settings *fifo_settings, struct bmp3_dev *dev); |
/*!
This internal API is used to parse the fifo_config_1(fifo_mode, fifo_stop_on_full, fifo_time_en, fifo_press_en, fifo_temp_en), fifo_config_2(fifo_subsampling, data_select) and int_ctrl(fwtm_en, ffull_en) settings and store it in device structure
| [in] | reg_data | : Pointer variable which stores the fifo settings data read from the sensor. |
| [out] | fifo_settings | : Structure instance of bmp3_fifo_settings which contains the fifo settings after parsing. / static void parse_fifo_settings(const uint8_t *reg_data, struct bmp3_fifo_settings *fifo_settings); |
/*!
This internal API parse the FIFO data frame from the fifo buffer and fills the byte count, uncompensated pressure and/or temperature data and no of parsed frames.
| [in] | header | : Pointer variable which stores the fifo settings data read from the sensor. |
| [in,out] | fifo | : Structure instance of bmp3_fifo |
| [out] | byte_index | : Byte count which is incremented according to the of data. |
| [out] | uncomp_data | : Uncompensated pressure and/or temperature data which is stored after parsing fifo buffer data. |
| [out] | parsed_frames | : Total number of parsed frames. |
| 0 | -> Success |
| <0 | -> Fail / static uint8_t parse_fifo_data_frame(uint8_t header, struct bmp3_fifo_data *fifo, uint16_t *byte_index, struct bmp3_uncomp_data *uncomp_data, uint8_t *parsed_frames); |
/*!
This internal API unpacks the FIFO data frame from the fifo buffer and fills the byte count, uncompensated pressure and/or temperature data.
| [out] | byte_index | : Byte count of fifo buffer. |
| [in] | fifo_buffer | : FIFO buffer from where the temperature and pressure frames are unpacked. |
| [out] | uncomp_data | : Uncompensated temperature and pressure data after unpacking from fifo buffer. / static void unpack_temp_press_frame(uint16_t *byte_index, const uint8_t *fifo_buffer, struct bmp3_uncomp_data *uncomp_data); |
/*!
This internal API unpacks the FIFO data frame from the fifo buffer and fills the byte count and uncompensated pressure data.
| [out] | byte_index | : Byte count of fifo buffer. |
| [in] | fifo_buffer | : FIFO buffer from where the pressure frames are unpacked. |
| [out] | uncomp_data | : Uncompensated pressure data after unpacking from fifo buffer. / static void unpack_press_frame(uint16_t *byte_index, const uint8_t *fifo_buffer, struct bmp3_uncomp_data *uncomp_data); |
/*!
This internal API unpacks the FIFO data frame from the fifo buffer and fills the byte count and uncompensated temperature data.
| [out] | byte_index | : Byte count of fifo buffer. |
| [in] | fifo_buffer | : FIFO buffer from where the temperature frames are unpacked. |
| [out] | uncomp_data | : Uncompensated temperature data after unpacking from fifo buffer. / static void unpack_temp_frame(uint16_t *byte_index, const uint8_t *fifo_buffer, struct bmp3_uncomp_data *uncomp_data); |
/*!
This internal API unpacks the time frame from the fifo data buffer and fills the byte count and update the sensor time variable.
| [out] | byte_index | : Byte count of fifo buffer. |
| [in] | fifo_buffer | : FIFO buffer from where the sensor time frames are unpacked. |
| [out] | sensor_time | : Variable used to store the sensor time. / static void unpack_time_frame(uint16_t *byte_index, const uint8_t *fifo_buffer, uint32_t *sensor_time); |
/*!
This internal API parses the FIFO buffer and gets the header info.
| [out] | header | : Variable used to store the fifo header data. |
| [in] | fifo_buffer | : FIFO buffer from where the header data is retrieved. |
| [out] | byte_index | : Byte count of fifo buffer. / static void get_header_info(uint8_t *header, const uint8_t *fifo_buffer, uint16_t *byte_index); |
/*!
This internal API parses the FIFO data frame from the fifo buffer and fills uncompensated temperature and/or pressure data.
| [in] | sensor_comp | : Variable used to select either temperature or pressure or both while parsing the fifo frames. |
| [in] | fifo_buffer | : FIFO buffer where the temperature or pressure or both the data to be parsed. |
| [out] | uncomp_data | : Uncompensated temperature or pressure or both the data after unpacking from fifo buffer. / static void parse_fifo_sensor_data(uint8_t sensor_comp, const uint8_t *fifo_buffer, struct bmp3_uncomp_data *uncomp_data); |
/*!
This internal API resets the FIFO buffer, start index, parsed frame count, configuration change, configuration error and frame_not_available variables.
| [out] | fifo | : FIFO structure instance where the fifo related variables are reset. / static void reset_fifo_index(struct bmp3_fifo_data *fifo); |
/*!
This API gets the command ready, data ready for pressure and temperature, power on reset status from the sensor.
| [out] | Structure instance of bmp3_status | |
| [in] | dev | : Structure instance of bmp3_dev |
| 0 | -> Success |
| <0 | -> Fail |
@brief This internal API fills the fifo_config_1(fifo_mode, fifo_stop_on_full, fifo_time_en, fifo_press_en, fifo_temp_en) settings in the reg_data variable so as to burst write in the sensor. ‍/
static int8_t fill_fifo_config_1(uint16_t desired_settings, const struct bmp3_fifo_settings *fifo_settings, struct bmp3_dev *dev) { int8_t rslt; uint8_t reg_addr = BMP3_REG_FIFO_CONFIG_1; uint8_t reg_data;
rslt = bmp3_get_regs(reg_addr, ®_data, 1, dev);
if (rslt == BMP3_OK) { if (desired_settings & BMP3_SEL_FIFO_MODE) { /* Fill the FIFO mode register data */ reg_data = BMP3_SET_BITS_POS_0(reg_data, BMP3_FIFO_MODE, fifo_settings->mode); }
if (desired_settings & BMP3_SEL_FIFO_STOP_ON_FULL_EN) { /* Fill the stop on full data */ reg_data = BMP3_SET_BITS(reg_data, BMP3_FIFO_STOP_ON_FULL, fifo_settings->stop_on_full_en); }
if (desired_settings & BMP3_SEL_FIFO_TIME_EN) { /* Fill the time enable data */ reg_data = BMP3_SET_BITS(reg_data, BMP3_FIFO_TIME_EN, fifo_settings->time_en); }
if (desired_settings & (BMP3_SEL_FIFO_PRESS_EN | BMP3_SEL_FIFO_TEMP_EN)) { /* Fill the pressure enable data */ reg_data = BMP3_SET_BITS(reg_data, BMP3_FIFO_PRESS_EN, fifo_settings->press_en);
/* Fill the temperature enable data */ reg_data = BMP3_SET_BITS(reg_data, BMP3_FIFO_TEMP_EN, fifo_settings->temp_en); }
/* Write the power control settings in the register */ rslt = bmp3_set_regs(®_addr, ®_data, 1, dev); }
return rslt; }
/*!
This internal API fills the fifo_config_2(fifo_subsampling, data_select) settings in the reg_data variable so as to burst write in the sensor. / static int8_t fill_fifo_config_2(uint16_t desired_settings, const struct bmp3_fifo_settings *fifo_settings, struct bmp3_dev *dev) { int8_t rslt; uint8_t reg_addr = BMP3_REG_FIFO_CONFIG_2; uint8_t reg_data;
rslt = bmp3_get_regs(reg_addr, ®_data, 1, dev);
if (rslt == BMP3_OK) { if (desired_settings & BMP3_SEL_FIFO_DOWN_SAMPLING) { /* To do check Normal mode / / Fill the down-sampling data */ reg_data = BMP3_SET_BITS_POS_0(reg_data, BMP3_FIFO_DOWN_SAMPLING, fifo_settings->down_sampling); }
if (desired_settings & BMP3_SEL_FIFO_FILTER_EN) { /* Fill the filter enable data */ reg_data = BMP3_SET_BITS(reg_data, BMP3_FIFO_FILTER_EN, fifo_settings->filter_en); }
/* Write the power control settings in the register */ rslt = bmp3_set_regs(®_addr, ®_data, 1, dev); }
return rslt; }
/*!
This internal API fills the fifo interrupt control(fwtm_en, ffull_en) settings in the reg_data variable so as to burst write in the sensor. / static int8_t fill_fifo_int_ctrl(uint16_t desired_settings, const struct bmp3_fifo_settings *fifo_settings, struct bmp3_dev *dev) { int8_t rslt; uint8_t reg_addr = BMP3_REG_INT_CTRL; uint8_t reg_data;
rslt = bmp3_get_regs(reg_addr, ®_data, 1, dev);
if (rslt == BMP3_OK) { if (desired_settings & BMP3_SEL_FIFO_FWTM_EN) { /* Fill the FIFO watermark interrupt enable data */ reg_data = BMP3_SET_BITS(reg_data, BMP3_FIFO_FWTM_EN, fifo_settings->fwtm_en); }
if (desired_settings & BMP3_SEL_FIFO_FULL_EN) { /* Fill the FIFO full interrupt enable data */ reg_data = BMP3_SET_BITS(reg_data, BMP3_FIFO_FULL_EN, fifo_settings->ffull_en); }
/* Write the power control settings in the register */ rslt = bmp3_set_regs(®_addr, ®_data, 1, dev); }
return rslt; }
/*!
This API gets the command ready, data ready for pressure and temperature, power on reset status from the sensor.
Definition at line 2898 of file bmp3.c.
References BMP3_GET_BITS, bmp3_get_regs(), BMP3_OK, BMP3_REG_EVENT, BMP3_REG_SENS_STATUS, bmp3_sens_status::cmd_rdy, bmp3_sens_status::drdy_press, bmp3_sens_status::drdy_temp, bmp3_status::pwr_on_rst, and bmp3_status::sensor.
Referenced by bmp3_get_status().


|
static |
This internal API interleaves the register address between the register data buffer for burst write operation.
| [in] | reg_addr | : Contains the register address array. |
| [out] | temp_buff | : Contains the temporary buffer to store the register data and register address. |
| [in] | reg_data | : Contains the register data to be written in the temporary buffer. |
| [in] | len | : No of bytes of data to be written for burst write. |
Definition at line 1807 of file bmp3.c.
Referenced by bmp3_set_regs().

|
static |
This internal API is used to validate the device pointer for null conditions.
This internal API is used to validate the device structure pointer for null conditions.
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 2724 of file bmp3.c.
References BMP3_E_NULL_PTR, BMP3_OK, bmp3_dev::delay_us, bmp3_dev::intf_ptr, NULL, bmp3_dev::read, and bmp3_dev::write.
Referenced by bmp3_get_regs(), bmp3_init(), bmp3_set_op_mode(), and bmp3_set_regs().

|
static |
This internal API parse the advance (i2c_wdt_en, i2c_wdt_sel) settings and store in the device structure.
| [in] | reg_data | : Pointer variable which stores the register data to parse. |
| [out] | settings | : Structure instance of bmp3_adv_settings. |
Definition at line 1849 of file bmp3.c.
References BMP3_GET_BITS, bmp3_adv_settings::i2c_wdt_en, and bmp3_adv_settings::i2c_wdt_sel.
Referenced by parse_sett_data().

|
static |
This internal API is used to parse the calibration data, compensates it and store it in device structure.
| [in] | dev | : Structure instance of bmp3_dev. |
| [out] | reg_data | : Contains calibration data to be parsed. |
Definition at line 2545 of file bmp3.c.
References BMP3_CONCAT_BYTES, bmp3_dev::calib_data, bmp3_reg_calib_data::par_p1, bmp3_reg_calib_data::par_p10, bmp3_reg_calib_data::par_p11, bmp3_reg_calib_data::par_p2, bmp3_reg_calib_data::par_p3, bmp3_reg_calib_data::par_p4, bmp3_reg_calib_data::par_p5, bmp3_reg_calib_data::par_p6, bmp3_reg_calib_data::par_p7, bmp3_reg_calib_data::par_p8, bmp3_reg_calib_data::par_p9, bmp3_reg_calib_data::par_t1, bmp3_reg_calib_data::par_t2, bmp3_reg_calib_data::par_t3, and bmp3_calib_data::reg_calib_data.
Referenced by get_calib_data().

|
static |
This internal API parse the interrupt control(output mode, level, latch and data ready) settings and store in the device structure.
| [in] | reg_data | : Pointer variable which stores the register data to parse. |
| [out] | settings | : Structure instance of bmp3_int_ctrl_settings. |
Definition at line 1842 of file bmp3.c.
References BMP3_GET_BITS, BMP3_GET_BITS_POS_0, bmp3_int_ctrl_settings::drdy_en, bmp3_int_ctrl_settings::latch, bmp3_int_ctrl_settings::level, and bmp3_int_ctrl_settings::output_mode.
Referenced by parse_sett_data().

|
static |
This internal API parse the over sampling, ODR and filter settings and store in the device structure.
| [in] | reg_data | : Pointer variable which stores the register data to parse. |
| [out] | settings | : Structure instance of bmp3_odr_filter_settings. |
Definition at line 1870 of file bmp3.c.
References BMP3_GET_BITS, BMP3_GET_BITS_POS_0, bmp3_odr_filter_settings::iir_filter, bmp3_odr_filter_settings::odr, bmp3_odr_filter_settings::press_os, and bmp3_odr_filter_settings::temp_os.
Referenced by get_odr_filter_settings(), and parse_sett_data().

|
static |
This internal API parse the power control(power mode, pressure enable and temperature enable) settings and store in the device structure.
| [in] | reg_data | : Pointer variable which stores the register data to parse. |
| [out] | settings | : Structure instance of bmp3_settings. |
Definition at line 1859 of file bmp3.c.
References BMP3_GET_BITS, BMP3_GET_BITS_POS_0, bmp3_settings::op_mode, bmp3_settings::press_en, and bmp3_settings::temp_en.
Referenced by parse_sett_data().

|
static |
This internal API is used to parse the pressure and temperature data and store it in the bmp3_uncomp_data structure instance.
This internal API is used to parse the pressure or temperature or both the data and store it in the bmp3_uncomp_data structure instance.
| [in] | reg_data | : Contains the register data which needs to be parsed. |
| [out] | uncomp_data | : Contains the uncompensated press and temp data. |
Definition at line 2273 of file bmp3.c.
References bmp3_uncomp_data::pressure, and bmp3_uncomp_data::temperature.
Referenced by bmp3_get_sensor_data().

|
static |
This internal API parse the power control(power mode, pressure enable and temperature enable), over sampling, ODR, filter and interrupt control settings and store in the device structure.
This internal API parse the power control(power mode, pressure enable and temperature enable), over sampling, ODR, filter, interrupt control and advance settings and store in the device structure.
| [in] | reg_data | : Register data to be parsed. |
| [in] | settings | : Structure instance of bmp3_settings |
Definition at line 1823 of file bmp3.c.
References bmp3_settings::adv_settings, bmp3_settings::int_settings, bmp3_settings::odr_filter, parse_advance_settings(), parse_int_ctrl_settings(), parse_odr_filter_settings(), and parse_pwr_ctrl_settings().
Referenced by bmp3_get_sensor_settings().


|
static |
This internal API is used to calculate the power functionality.
| [in] | base | : Contains the base value. |
| [in] | power | : Contains the power value. |
| Calculated | power function output in integer. |
Definition at line 2683 of file bmp3.c.
Referenced by calculate_press_meas_time(), and calculate_temp_meas_time().

|
static |
This internal API puts the device to sleep mode.
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 1743 of file bmp3.c.
References bmp3_get_regs(), BMP3_OK, BMP3_OP_MODE_MSK, BMP3_REG_PWR_CTRL, and bmp3_set_regs().
Referenced by bmp3_set_op_mode().


|
static |
This internal API sets the advance (i2c_wdt_en, i2c_wdt_sel) settings of the sensor based on the settings selected by the user.
| [in] | desired_settings | : Variable used to select the settings which are to be set. |
| [in] | settings | : Structure instance of bmp3_settings |
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 2037 of file bmp3.c.
References bmp3_settings::adv_settings, bmp3_get_regs(), BMP3_OK, BMP3_REG_IF_CONF, BMP3_SEL_I2C_WDT, BMP3_SEL_I2C_WDT_EN, BMP3_SET_BITS, bmp3_set_regs(), bmp3_adv_settings::i2c_wdt_en, and bmp3_adv_settings::i2c_wdt_sel.
Referenced by bmp3_set_sensor_settings().


|
static |
This internal API sets the interrupt control (output mode, level, latch and data ready) settings of the sensor based on the settings selected by the user.
| [in] | desired_settings | : Variable used to select the settings which are to be set. |
| [in] | settings | : Structure instance of bmp3_settings |
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 1987 of file bmp3.c.
References bmp3_get_regs(), BMP3_OK, BMP3_REG_INT_CTRL, BMP3_SEL_DRDY_EN, BMP3_SEL_LATCH, BMP3_SEL_LEVEL, BMP3_SEL_OUTPUT_MODE, BMP3_SET_BITS, BMP3_SET_BITS_POS_0, bmp3_set_regs(), bmp3_int_ctrl_settings::drdy_en, bmp3_settings::int_settings, bmp3_int_ctrl_settings::latch, bmp3_int_ctrl_settings::level, and bmp3_int_ctrl_settings::output_mode.
Referenced by bmp3_set_sensor_settings().


|
static |
This internal API sets the normal mode in the sensor.
This internal API converts the no. of frames required by the user to bytes so as to write in the watermark length register.
| [in] | settings | : Structure instance of bmp3_settings. |
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
@brief This internal API resets the FIFO buffer, start index, parsed frame count, configuration change, configuration error and frame_not_available variables. ‍/
//static void reset_fifo_index(struct bmp3_fifo_data <em>fifo) //{ // / Loop variable / // uint16_t index; // // / Variable for FIFO size / // uint16_t fifo_size = 512; // // / The size of FIFO in BMP3 is 512 bytes / // for (index = 0; index < fifo_size; index++) // { // / Initialize data buffer to zero / // fifo->buffer[index] = 0; // } // // fifo->byte_count = 0; // fifo->start_idx = 0; // fifo->parsed_frames = 0; // fifo->config_change = 0; // fifo->config_err = 0; // fifo->frame_not_available = 0; //} // ///! // * This internal API parse the FIFO data frame from the fifo buffer and // * fills the byte count, uncompensated pressure and/or temperature data and no // * of parsed frames. // */ //static uint8_t parse_fifo_data_frame(uint8_t header, // struct bmp3_fifo_data *fifo, // uint16_t *byte_index, // struct bmp3_uncomp_data *uncomp_data, // uint8_t *parsed_frames) //{ // uint8_t t_p_frame = FALSE; // // switch (header) // { // case BMP3_FIFO_TEMP_PRESS_FRAME: // unpack_temp_press_frame(byte_index, fifo->buffer, uncomp_data); // *parsed_frames = *parsed_frames + 1; // t_p_frame = BMP3_PRESS_TEMP; // break; // case BMP3_FIFO_TEMP_FRAME: // unpack_temp_frame(byte_index, fifo->buffer, uncomp_data); // *parsed_frames = *parsed_frames + 1; // t_p_frame = BMP3_TEMP; // break; // case BMP3_FIFO_PRESS_FRAME: // unpack_press_frame(byte_index, fifo->buffer, uncomp_data); // *parsed_frames = *parsed_frames + 1; // t_p_frame = BMP3_PRESS; // break; // case BMP3_FIFO_TIME_FRAME: // unpack_time_frame(byte_index, fifo->buffer, &fifo->sensor_time); // break; // case BMP3_FIFO_CONFIG_CHANGE: // fifo->config_change = 1; // *byte_index = *byte_index + 1; // break; // case BMP3_FIFO_ERROR_FRAME: // fifo->config_err = 1; // *byte_index = *byte_index + 1; // break; // case BMP3_FIFO_EMPTY_FRAME: // *byte_index = fifo->byte_count; // break; // default: // fifo->config_err = 1; // *byte_index = *byte_index + 1; // break; // } // // return t_p_frame; //}
/*!
This internal API unpacks the FIFO data frame from the fifo buffer and fills the byte count, uncompensated pressure and/or temperature data. / static void unpack_temp_press_frame(uint16_t *byte_index, const uint8_t *fifo_buffer, struct bmp3_uncomp_data *uncomp_data) { parse_fifo_sensor_data((BMP3_PRESS_TEMP), &fifo_buffer[*byte_index], uncomp_data); *byte_index = *byte_index + BMP3_LEN_P_T_DATA; }
/*!
This internal API unpacks the FIFO data frame from the fifo buffer and fills the byte count and uncompensated temperature data. / static void unpack_temp_frame(uint16_t *byte_index, const uint8_t *fifo_buffer, struct bmp3_uncomp_data *uncomp_data) { parse_fifo_sensor_data(BMP3_TEMP, &fifo_buffer[*byte_index], uncomp_data); *byte_index = *byte_index + BMP3_LEN_T_DATA; }
/*!
This internal API unpacks the FIFO data frame from the fifo buffer and fills the byte count and uncompensated pressure data. / static void unpack_press_frame(uint16_t *byte_index, const uint8_t *fifo_buffer, struct bmp3_uncomp_data *uncomp_data) { parse_fifo_sensor_data(BMP3_PRESS, &fifo_buffer[*byte_index], uncomp_data); *byte_index = *byte_index + BMP3_LEN_P_DATA; }
/*!
This internal API unpacks the time frame from the fifo data buffer and fills the byte count and update the sensor time variable. / static void unpack_time_frame(uint16_t *byte_index, const uint8_t *fifo_buffer, uint32_t *sensor_time) { uint16_t index = *byte_index; uint32_t xlsb = fifo_buffer[index]; uint32_t lsb = ((uint32_t)fifo_buffer[index + 1]) << 8; uint32_t msb = ((uint32_t)fifo_buffer[index + 2]) << 16;
*sensor_time = msb | lsb | xlsb; *byte_index = *byte_index + BMP3_LEN_SENSOR_TIME; }
/*!
This internal API parses the FIFO data frame from the fifo buffer and fills uncompensated temperature and/or pressure data. / static void parse_fifo_sensor_data(uint8_t sensor_comp, const uint8_t <em>fifo_buffer, struct bmp3_uncomp_data *uncomp_data) { / Temporary variables to store the sensor data */ uint32_t data_xlsb; uint32_t data_lsb; uint32_t data_msb;
/* Store the parsed register values for temperature data */ data_xlsb = (uint32_t)fifo_buffer[0]; data_lsb = (uint32_t)fifo_buffer[1] << 8; data_msb = (uint32_t)fifo_buffer[2] << 16;
if (sensor_comp == BMP3_TEMP) { /* Update uncompensated temperature */ uncomp_data->temperature = data_msb | data_lsb | data_xlsb; }
if (sensor_comp == BMP3_PRESS) { /* Update uncompensated pressure */ uncomp_data->pressure = data_msb | data_lsb | data_xlsb; }
if (sensor_comp == (BMP3_PRESS_TEMP)) { uncomp_data->temperature = data_msb | data_lsb | data_xlsb;
/* Store the parsed register values for pressure data */ data_xlsb = (uint32_t)fifo_buffer[3]; data_lsb = (uint32_t)fifo_buffer[4] << 8; data_msb = (uint32_t)fifo_buffer[5] << 16; uncomp_data->pressure = data_msb | data_lsb | data_xlsb; } }
/*!
This internal API parses the FIFO buffer and gets the header info.
This internal API sets the normal mode in the sensor.
Definition at line 1680 of file bmp3.c.
References BMP3_E_CONFIGURATION_ERR, BMP3_ERR_CONF, bmp3_get_regs(), BMP3_OK, BMP3_REG_ERR, validate_normal_mode_settings(), and write_power_mode().
Referenced by bmp3_set_op_mode().


|
static |
This internal API sets the over sampling, ODR and filter settings of the sensor based on the settings selected by the user.
| [in] | desired_settings | : Variable used to select the settings which are to be set. |
| [in] | settings | : Structure instance of bmp3_settings |
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 1928 of file bmp3.c.
References are_settings_changed(), bmp3_get_regs(), BMP3_MODE_NORMAL, BMP3_OK, BMP3_REG_OSR, BMP3_SEL_IIR_FILTER, BMP3_SEL_ODR, BMP3_SEL_PRESS_OS, BMP3_SEL_TEMP_OS, bmp3_set_regs(), fill_filter_data(), fill_odr_data(), fill_osr_data(), bmp3_settings::op_mode, and validate_osr_and_odr_settings().
Referenced by bmp3_set_sensor_settings().


|
static |
This internal API sets the pressure enable and temperature enable settings of the sensor.
This API sets the pressure enable and temperature enable settings of the sensor.
| [in] | desired_settings | : Contains the settings which user wants to change. |
| [in] | settings | : Structure instance of bmp3_settings |
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 1891 of file bmp3.c.
References bmp3_get_regs(), BMP3_OK, BMP3_REG_PWR_CTRL, BMP3_SEL_PRESS_EN, BMP3_SEL_TEMP_EN, BMP3_SET_BITS, BMP3_SET_BITS_POS_0, bmp3_set_regs(), bmp3_settings::press_en, and bmp3_settings::temp_en.
Referenced by bmp3_set_sensor_settings().


|
static |
This internal API validate the normal mode settings of the sensor.
| [out] | settings | : Structure instance of bmp3_settings. |
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 1768 of file bmp3.c.
References BMP3_OK, get_odr_filter_settings(), and validate_osr_and_odr_settings().
Referenced by set_normal_mode().


|
static |
This internal API validate the over sampling, ODR settings of the sensor.
| [out] | settings | : Structure instance of bmp3_settings. |
| 0 | -> Success |
| <0 | -> Fail |
Definition at line 2090 of file bmp3.c.
References calculate_press_meas_time(), calculate_temp_meas_time(), bmp3_odr_filter_settings::odr, bmp3_settings::odr_filter, bmp3_settings::press_en, bmp3_settings::temp_en, and verify_meas_time_and_odr_duration().
Referenced by set_odr_filter_settings(), and validate_normal_mode_settings().


|
static |
This internal API checks whether the measurement time and ODR duration of the sensor are proper.
| [in] | meas_t | : Pressure and temperature measurement time in microseconds. |
| [in] | odr_duration | : Duration in microseconds corresponding to the ODR value. |
| 0 | -> Success |
| >0 | -> Warning |
Definition at line 2130 of file bmp3.c.
References BMP3_E_INVALID_ODR_OSR_SETTINGS, and BMP3_OK.
Referenced by validate_osr_and_odr_settings().

|
static |
This internal API writes the power mode in the sensor.
| [out] | settings | : Structure instance of bmp3_settings. |
| [in] | dev | : Structure instance of bmp3_dev. |
| 0 | -> Success |
| >0 | -> Warning |
| <0 | -> Fail |
Definition at line 1716 of file bmp3.c.
References bmp3_get_regs(), BMP3_OK, BMP3_REG_PWR_CTRL, BMP3_SET_BITS, bmp3_set_regs(), and bmp3_settings::op_mode.
Referenced by bmp3_set_op_mode(), and set_normal_mode().

