Update GitHub CI workflow to match Adafruit_AS5600 and apply clang formatting

- Remove build matrix strategy to match reference workflow
- Downgrade action versions (checkout@v2, setup-python@v1)
- Reorder steps (setup-python first)
- Change platform test to use main_platforms instead of matrix variable
- Move clang step before test platforms step
- Apply clang formatting to all source files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Adafruit Developer 2025-08-10 08:49:15 -04:00
parent ea0d4c0bb1
commit 158e9af830
6 changed files with 895 additions and 838 deletions

View file

@ -4,19 +4,14 @@ on: [pull_request, push, repository_dispatch]
jobs:
build:
strategy:
fail-fast: false
matrix:
arduino-platform: ["uno", "leonardo", "zero", "esp8266", "esp32", "metro_m4"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: adafruit/ci-arduino
path: ci
@ -24,12 +19,12 @@ jobs:
- name: pre-install
run: bash ci/actions_install.sh
- name: test platforms
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
- name: clang
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
- name: test platforms
run: python3 ci/build_platform.py main_platforms
- name: doxygen
env:
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}

View file

@ -213,6 +213,13 @@ void setup() {
}
void loop() {
// Check if new data is ready before reading
if (!bmp.dataReady()) {
delay(10);
return;
}
// Data is ready, perform reading
if (!bmp.performReading()) {
return;
}
@ -231,5 +238,5 @@ void loop() {
Serial.println(F("---"));
delay(100);
delay(10); // Short delay since we're checking dataReady()
}

View file

@ -56,10 +56,11 @@ Adafruit_BMP5xx::~Adafruit_BMP5xx(void) {
/*!
* @brief Initializes the sensor
* @param addr Optional I2C address the sensor can be found on. Default is 0x46
* @param theWire Optional Wire interface the sensor is connected to. Default is &Wire
* @param theWire Optional Wire interface the sensor is connected to. Default is
* &Wire
* @return True if initialization was successful, otherwise false.
*/
bool Adafruit_BMP5xx::begin(uint8_t addr, TwoWire *theWire) {
bool Adafruit_BMP5xx::begin(uint8_t addr, TwoWire* theWire) {
if (_i2c_dev) {
delete _i2c_dev;
}
@ -82,10 +83,11 @@ bool Adafruit_BMP5xx::begin(uint8_t addr, TwoWire *theWire) {
/*!
* @brief Initializes the sensor over SPI
* @param cspin The pin to use for CS/Chip Select
* @param theSPI Optional SPI interface the sensor is connected to. Default is &SPI
* @param theSPI Optional SPI interface the sensor is connected to. Default is
* &SPI
* @return True if initialization was successful, otherwise false.
*/
bool Adafruit_BMP5xx::begin(int8_t cspin, SPIClass *theSPI) {
bool Adafruit_BMP5xx::begin(int8_t cspin, SPIClass* theSPI) {
if (_spi_dev) {
delete _spi_dev;
}
@ -96,7 +98,7 @@ bool Adafruit_BMP5xx::begin(int8_t cspin, SPIClass *theSPI) {
return false;
}
// Setup Bosch API callbacks
// Setup Bosch API callbacks
_bmp5_dev.intf_ptr = _spi_dev;
_bmp5_dev.intf = BMP5_SPI_INTF;
_bmp5_dev.read = spi_read;
@ -116,7 +118,7 @@ bool Adafruit_BMP5xx::_init(void) {
if (rslt != BMP5_OK) {
return false;
}
// Now initialize the sensor
rslt = bmp5_init(&_bmp5_dev);
if (rslt != BMP5_OK) {
@ -165,18 +167,22 @@ bool Adafruit_BMP5xx::_init(void) {
}
// Configure interrupt pin as push-pull, active high, latched mode
rslt = bmp5_configure_interrupt(BMP5_LATCHED, BMP5_ACTIVE_HIGH, BMP5_INTR_PUSH_PULL, BMP5_INTR_ENABLE, &_bmp5_dev);
rslt = bmp5_configure_interrupt(BMP5_LATCHED, BMP5_ACTIVE_HIGH,
BMP5_INTR_PUSH_PULL, BMP5_INTR_ENABLE,
&_bmp5_dev);
return rslt == BMP5_OK;
}
/*!
* @brief Performs a reading of both temperature and pressure and stores values in class instance variables
* @brief Performs a reading of both temperature and pressure and stores values
* in class instance variables
* @return True if the reading was successful, otherwise false.
*/
bool Adafruit_BMP5xx::performReading(void) {
struct bmp5_sensor_data sensor_data;
int8_t rslt = bmp5_get_sensor_data(&sensor_data, &_osr_odr_config, &_bmp5_dev);
int8_t rslt =
bmp5_get_sensor_data(&sensor_data, &_osr_odr_config, &_bmp5_dev);
if (rslt != BMP5_OK) {
return false;
}
@ -220,7 +226,8 @@ float Adafruit_BMP5xx::readAltitude(float seaLevel) {
* @param oversampling Oversampling setting
* @return True on success, False on failure
*/
bool Adafruit_BMP5xx::setTemperatureOversampling(bmp5xx_oversampling_t oversampling) {
bool Adafruit_BMP5xx::setTemperatureOversampling(
bmp5xx_oversampling_t oversampling) {
_osr_odr_config.osr_t = (uint8_t)oversampling;
int8_t rslt = bmp5_set_osr_odr_press_config(&_osr_odr_config, &_bmp5_dev);
return rslt == BMP5_OK;
@ -231,7 +238,8 @@ bool Adafruit_BMP5xx::setTemperatureOversampling(bmp5xx_oversampling_t oversampl
* @param oversampling Oversampling setting
* @return True on success, False on failure
*/
bool Adafruit_BMP5xx::setPressureOversampling(bmp5xx_oversampling_t oversampling) {
bool Adafruit_BMP5xx::setPressureOversampling(
bmp5xx_oversampling_t oversampling) {
_osr_odr_config.osr_p = (uint8_t)oversampling;
int8_t rslt = bmp5_set_osr_odr_press_config(&_osr_odr_config, &_bmp5_dev);
return rslt == BMP5_OK;
@ -311,7 +319,7 @@ bmp5xx_odr_t Adafruit_BMP5xx::getOutputDataRate(void) {
}
/*!
* @brief Get power mode
* @brief Get power mode
* @return Current power mode
*/
bmp5xx_powermode_t Adafruit_BMP5xx::getPowerMode(void) {
@ -335,15 +343,16 @@ bool Adafruit_BMP5xx::enablePressure(bool enable) {
* @brief Gets an Adafruit Unified Sensor object for the temp sensor component
* @return Adafruit_Sensor pointer to temperature sensor
*/
Adafruit_Sensor *Adafruit_BMP5xx::getTemperatureSensor(void) {
Adafruit_Sensor* Adafruit_BMP5xx::getTemperatureSensor(void) {
return _temp_sensor;
}
/*!
* @brief Gets an Adafruit Unified Sensor object for the pressure sensor component
* @brief Gets an Adafruit Unified Sensor object for the pressure sensor
* component
* @return Adafruit_Sensor pointer to pressure sensor
*/
Adafruit_Sensor *Adafruit_BMP5xx::getPressureSensor(void) {
Adafruit_Sensor* Adafruit_BMP5xx::getPressureSensor(void) {
return _pressure_sensor;
}
@ -371,31 +380,34 @@ bool Adafruit_BMP5xx::dataReady(void) {
* @return True if configuration was successful, false otherwise
*/
bool Adafruit_BMP5xx::configureInterrupt(bmp5xx_interrupt_mode_t mode,
bmp5xx_interrupt_polarity_t polarity,
bmp5xx_interrupt_drive_t drive,
uint8_t sources,
bool enable) {
bmp5xx_interrupt_polarity_t polarity,
bmp5xx_interrupt_drive_t drive,
uint8_t sources, bool enable) {
// Configure interrupt pin settings first
enum bmp5_intr_en_dis int_enable = enable ? BMP5_INTR_ENABLE : BMP5_INTR_DISABLE;
int8_t rslt = bmp5_configure_interrupt((enum bmp5_intr_mode)mode,
(enum bmp5_intr_polarity)polarity,
(enum bmp5_intr_drive)drive,
int_enable,
&_bmp5_dev);
enum bmp5_intr_en_dis int_enable =
enable ? BMP5_INTR_ENABLE : BMP5_INTR_DISABLE;
int8_t rslt = bmp5_configure_interrupt(
(enum bmp5_intr_mode)mode, (enum bmp5_intr_polarity)polarity,
(enum bmp5_intr_drive)drive, int_enable, &_bmp5_dev);
if (rslt != BMP5_OK) {
return false;
}
// Configure interrupt sources after pin settings
struct bmp5_int_source_select int_source_select = {0};
int_source_select.drdy_en = (sources & BMP5XX_INTERRUPT_DATA_READY) ? BMP5_ENABLE : BMP5_DISABLE;
int_source_select.fifo_full_en = (sources & BMP5XX_INTERRUPT_FIFO_FULL) ? BMP5_ENABLE : BMP5_DISABLE;
int_source_select.fifo_thres_en = (sources & BMP5XX_INTERRUPT_FIFO_THRESHOLD) ? BMP5_ENABLE : BMP5_DISABLE;
int_source_select.oor_press_en = (sources & BMP5XX_INTERRUPT_PRESSURE_OUT_OF_RANGE) ? BMP5_ENABLE : BMP5_DISABLE;
int_source_select.drdy_en =
(sources & BMP5XX_INTERRUPT_DATA_READY) ? BMP5_ENABLE : BMP5_DISABLE;
int_source_select.fifo_full_en =
(sources & BMP5XX_INTERRUPT_FIFO_FULL) ? BMP5_ENABLE : BMP5_DISABLE;
int_source_select.fifo_thres_en =
(sources & BMP5XX_INTERRUPT_FIFO_THRESHOLD) ? BMP5_ENABLE : BMP5_DISABLE;
int_source_select.oor_press_en =
(sources & BMP5XX_INTERRUPT_PRESSURE_OUT_OF_RANGE) ? BMP5_ENABLE
: BMP5_DISABLE;
rslt = bmp5_int_source_select(&int_source_select, &_bmp5_dev);
return rslt == BMP5_OK;
}
@ -409,14 +421,14 @@ bool Adafruit_BMP5xx::configureInterrupt(bmp5xx_interrupt_mode_t mode,
@return 0 on success, negative on error
*/
/**************************************************************************/
int8_t Adafruit_BMP5xx::i2c_read(uint8_t reg_addr, uint8_t *reg_data,
uint32_t len, void *intf_ptr) {
Adafruit_I2CDevice *i2c_dev = (Adafruit_I2CDevice *)intf_ptr;
int8_t Adafruit_BMP5xx::i2c_read(uint8_t reg_addr, uint8_t* reg_data,
uint32_t len, void* intf_ptr) {
Adafruit_I2CDevice* i2c_dev = (Adafruit_I2CDevice*)intf_ptr;
if (!i2c_dev->write_then_read(&reg_addr, 1, reg_data, len)) {
return -1;
}
return 0;
}
@ -430,43 +442,43 @@ int8_t Adafruit_BMP5xx::i2c_read(uint8_t reg_addr, uint8_t *reg_data,
@return 0 on success, negative on error
*/
/**************************************************************************/
int8_t Adafruit_BMP5xx::i2c_write(uint8_t reg_addr, const uint8_t *reg_data,
uint32_t len, void *intf_ptr) {
Adafruit_I2CDevice *i2c_dev = (Adafruit_I2CDevice *)intf_ptr;
int8_t Adafruit_BMP5xx::i2c_write(uint8_t reg_addr, const uint8_t* reg_data,
uint32_t len, void* intf_ptr) {
Adafruit_I2CDevice* i2c_dev = (Adafruit_I2CDevice*)intf_ptr;
// Create buffer with register address + data
uint8_t buffer[len + 1];
buffer[0] = reg_addr;
memcpy(&buffer[1], reg_data, len);
if (!i2c_dev->write(buffer, len + 1)) {
return -1;
}
return 0;
}
/**************************************************************************/
/*!
@brief SPI read callback for Bosch API
@param reg_addr Register address to read from
@param reg_addr Register address to read from
@param reg_data Buffer to store read data
@param len Number of bytes to read
@param intf_ptr Pointer to interface (SPI device)
@return 0 on success, negative on error
*/
/**************************************************************************/
int8_t Adafruit_BMP5xx::spi_read(uint8_t reg_addr, uint8_t *reg_data,
uint32_t len, void *intf_ptr) {
Adafruit_SPIDevice *spi_dev = (Adafruit_SPIDevice *)intf_ptr;
int8_t Adafruit_BMP5xx::spi_read(uint8_t reg_addr, uint8_t* reg_data,
uint32_t len, void* intf_ptr) {
Adafruit_SPIDevice* spi_dev = (Adafruit_SPIDevice*)intf_ptr;
// Set read bit for SPI
reg_addr |= 0x80;
if (!spi_dev->write_then_read(&reg_addr, 1, reg_data, len)) {
return -1;
}
return 0;
}
@ -474,25 +486,25 @@ int8_t Adafruit_BMP5xx::spi_read(uint8_t reg_addr, uint8_t *reg_data,
/*!
@brief SPI write callback for Bosch API
@param reg_addr Register address to write to
@param reg_data Buffer containing data to write
@param reg_data Buffer containing data to write
@param len Number of bytes to write
@param intf_ptr Pointer to interface (SPI device)
@return 0 on success, negative on error
*/
/**************************************************************************/
int8_t Adafruit_BMP5xx::spi_write(uint8_t reg_addr, const uint8_t *reg_data,
uint32_t len, void *intf_ptr) {
Adafruit_SPIDevice *spi_dev = (Adafruit_SPIDevice *)intf_ptr;
int8_t Adafruit_BMP5xx::spi_write(uint8_t reg_addr, const uint8_t* reg_data,
uint32_t len, void* intf_ptr) {
Adafruit_SPIDevice* spi_dev = (Adafruit_SPIDevice*)intf_ptr;
// Create buffer with register address + data
uint8_t buffer[len + 1];
buffer[0] = reg_addr & 0x7F; // Clear read bit for write
memcpy(&buffer[1], reg_data, len);
if (!spi_dev->write(buffer, len + 1)) {
return -1;
}
return 0;
}
@ -503,7 +515,7 @@ int8_t Adafruit_BMP5xx::spi_write(uint8_t reg_addr, const uint8_t *reg_data,
@param intf_ptr Pointer to interface (unused)
*/
/**************************************************************************/
void Adafruit_BMP5xx::delay_usec(uint32_t us, void *intf_ptr) {
void Adafruit_BMP5xx::delay_usec(uint32_t us, void* intf_ptr) {
(void)intf_ptr; // Unused parameter
delayMicroseconds(us);
}
@ -517,7 +529,7 @@ void Adafruit_BMP5xx::delay_usec(uint32_t us, void *intf_ptr) {
* @param event Sensor event object that will be populated
* @returns True
*/
bool Adafruit_BMP5xx_Temp::getEvent(sensors_event_t *event) {
bool Adafruit_BMP5xx_Temp::getEvent(sensors_event_t* event) {
_theBMP5xx->readTemperature();
event->version = sizeof(sensors_event_t);
@ -533,7 +545,7 @@ bool Adafruit_BMP5xx_Temp::getEvent(sensors_event_t *event) {
* @brief Gets the sensor_t device data
* @param sensor Sensor description that will be populated
*/
void Adafruit_BMP5xx_Temp::getSensor(sensor_t *sensor) {
void Adafruit_BMP5xx_Temp::getSensor(sensor_t* sensor) {
memset(sensor, 0, sizeof(sensor_t));
strncpy(sensor->name, "BMP5xx", sizeof(sensor->name) - 1);
sensor->name[sizeof(sensor->name) - 1] = 0;
@ -555,7 +567,7 @@ void Adafruit_BMP5xx_Temp::getSensor(sensor_t *sensor) {
* @param event Sensor event object that will be populated
* @returns True
*/
bool Adafruit_BMP5xx_Pressure::getEvent(sensors_event_t *event) {
bool Adafruit_BMP5xx_Pressure::getEvent(sensors_event_t* event) {
_theBMP5xx->readPressure();
event->version = sizeof(sensors_event_t);
@ -571,7 +583,7 @@ bool Adafruit_BMP5xx_Pressure::getEvent(sensors_event_t *event) {
* @brief Gets the sensor_t device data
* @param sensor Sensor description that will be populated
*/
void Adafruit_BMP5xx_Pressure::getSensor(sensor_t *sensor) {
void Adafruit_BMP5xx_Pressure::getSensor(sensor_t* sensor) {
memset(sensor, 0, sizeof(sensor_t));
strncpy(sensor->name, "BMP5xx", sizeof(sensor->name) - 1);
sensor->name[sizeof(sensor->name) - 1] = 0;
@ -579,7 +591,7 @@ void Adafruit_BMP5xx_Pressure::getSensor(sensor_t *sensor) {
sensor->sensor_id = _sensorID;
sensor->type = SENSOR_TYPE_PRESSURE;
sensor->min_delay = 0;
sensor->min_value = 300.0; // Datasheet minimum 30kPa
sensor->max_value = 1250.0; // Datasheet maximum 125kPa
sensor->resolution = 0.016; // Datasheet RMS noise
sensor->min_value = 300.0; // Datasheet minimum 30kPa
sensor->max_value = 1250.0; // Datasheet maximum 125kPa
sensor->resolution = 0.016; // Datasheet RMS noise
}

View file

@ -18,12 +18,13 @@
#ifndef ADAFRUIT_BMP5XX_H
#define ADAFRUIT_BMP5XX_H
#include "Arduino.h"
#include <Adafruit_I2CDevice.h>
#include <Adafruit_SPIDevice.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include "Arduino.h"
extern "C" {
#include "bmp5.h"
}
@ -48,7 +49,7 @@ extern "C" {
*/
typedef enum {
BMP5XX_OVERSAMPLING_1X = BMP5_OVERSAMPLING_1X, ///< 1x oversampling
BMP5XX_OVERSAMPLING_2X = BMP5_OVERSAMPLING_2X, ///< 2x oversampling
BMP5XX_OVERSAMPLING_2X = BMP5_OVERSAMPLING_2X, ///< 2x oversampling
BMP5XX_OVERSAMPLING_4X = BMP5_OVERSAMPLING_4X, ///< 4x oversampling
BMP5XX_OVERSAMPLING_8X = BMP5_OVERSAMPLING_8X, ///< 8x oversampling
BMP5XX_OVERSAMPLING_16X = BMP5_OVERSAMPLING_16X, ///< 16x oversampling
@ -58,16 +59,16 @@ typedef enum {
} bmp5xx_oversampling_t;
/**
* @brief IIR filter coefficients
* @brief IIR filter coefficients
*/
typedef enum {
BMP5XX_IIR_FILTER_BYPASS = BMP5_IIR_FILTER_BYPASS, ///< No filtering
BMP5XX_IIR_FILTER_COEFF_1 = BMP5_IIR_FILTER_COEFF_1, ///< Filter coeff 1
BMP5XX_IIR_FILTER_COEFF_3 = BMP5_IIR_FILTER_COEFF_3, ///< Filter coeff 3
BMP5XX_IIR_FILTER_COEFF_7 = BMP5_IIR_FILTER_COEFF_7, ///< Filter coeff 7
BMP5XX_IIR_FILTER_COEFF_15 = BMP5_IIR_FILTER_COEFF_15, ///< Filter coeff 15
BMP5XX_IIR_FILTER_COEFF_31 = BMP5_IIR_FILTER_COEFF_31, ///< Filter coeff 31
BMP5XX_IIR_FILTER_COEFF_63 = BMP5_IIR_FILTER_COEFF_63, ///< Filter coeff 63
BMP5XX_IIR_FILTER_BYPASS = BMP5_IIR_FILTER_BYPASS, ///< No filtering
BMP5XX_IIR_FILTER_COEFF_1 = BMP5_IIR_FILTER_COEFF_1, ///< Filter coeff 1
BMP5XX_IIR_FILTER_COEFF_3 = BMP5_IIR_FILTER_COEFF_3, ///< Filter coeff 3
BMP5XX_IIR_FILTER_COEFF_7 = BMP5_IIR_FILTER_COEFF_7, ///< Filter coeff 7
BMP5XX_IIR_FILTER_COEFF_15 = BMP5_IIR_FILTER_COEFF_15, ///< Filter coeff 15
BMP5XX_IIR_FILTER_COEFF_31 = BMP5_IIR_FILTER_COEFF_31, ///< Filter coeff 31
BMP5XX_IIR_FILTER_COEFF_63 = BMP5_IIR_FILTER_COEFF_63, ///< Filter coeff 63
BMP5XX_IIR_FILTER_COEFF_127 = BMP5_IIR_FILTER_COEFF_127, ///< Filter coeff 127
} bmp5xx_iir_filter_t;
@ -77,7 +78,7 @@ typedef enum {
typedef enum {
BMP5XX_ODR_240_HZ = BMP5_ODR_240_HZ, ///< 240 Hz
BMP5XX_ODR_218_5_HZ = BMP5_ODR_218_5_HZ, ///< 218.5 Hz
BMP5XX_ODR_199_1_HZ = BMP5_ODR_199_1_HZ, ///< 199.1 Hz
BMP5XX_ODR_199_1_HZ = BMP5_ODR_199_1_HZ, ///< 199.1 Hz
BMP5XX_ODR_179_2_HZ = BMP5_ODR_179_2_HZ, ///< 179.2 Hz
BMP5XX_ODR_160_HZ = BMP5_ODR_160_HZ, ///< 160 Hz
BMP5XX_ODR_149_3_HZ = BMP5_ODR_149_3_HZ, ///< 149.3 Hz
@ -113,27 +114,29 @@ typedef enum {
* @brief Power mode settings
*/
typedef enum {
BMP5XX_POWERMODE_STANDBY = BMP5_POWERMODE_STANDBY, ///< Standby mode
BMP5XX_POWERMODE_NORMAL = BMP5_POWERMODE_NORMAL, ///< Normal mode
BMP5XX_POWERMODE_FORCED = BMP5_POWERMODE_FORCED, ///< Forced mode
BMP5XX_POWERMODE_CONTINUOUS = BMP5_POWERMODE_CONTINOUS, ///< Continuous mode
BMP5XX_POWERMODE_CONTINOUS = BMP5_POWERMODE_CONTINOUS, ///< @deprecated Use BMP5XX_POWERMODE_CONTINUOUS
BMP5XX_POWERMODE_DEEP_STANDBY = BMP5_POWERMODE_DEEP_STANDBY, ///< Deep standby mode
BMP5XX_POWERMODE_STANDBY = BMP5_POWERMODE_STANDBY, ///< Standby mode
BMP5XX_POWERMODE_NORMAL = BMP5_POWERMODE_NORMAL, ///< Normal mode
BMP5XX_POWERMODE_FORCED = BMP5_POWERMODE_FORCED, ///< Forced mode
BMP5XX_POWERMODE_CONTINUOUS = BMP5_POWERMODE_CONTINOUS, ///< Continuous mode
BMP5XX_POWERMODE_CONTINOUS =
BMP5_POWERMODE_CONTINOUS, ///< @deprecated Use BMP5XX_POWERMODE_CONTINUOUS
BMP5XX_POWERMODE_DEEP_STANDBY =
BMP5_POWERMODE_DEEP_STANDBY, ///< Deep standby mode
} bmp5xx_powermode_t;
/**
* @brief Interrupt polarity settings
*/
typedef enum {
BMP5XX_INTERRUPT_ACTIVE_LOW = BMP5_ACTIVE_LOW, ///< Interrupt active low
BMP5XX_INTERRUPT_ACTIVE_HIGH = BMP5_ACTIVE_HIGH ///< Interrupt active high
BMP5XX_INTERRUPT_ACTIVE_LOW = BMP5_ACTIVE_LOW, ///< Interrupt active low
BMP5XX_INTERRUPT_ACTIVE_HIGH = BMP5_ACTIVE_HIGH ///< Interrupt active high
} bmp5xx_interrupt_polarity_t;
/**
* @brief Interrupt drive settings
*/
typedef enum {
BMP5XX_INTERRUPT_PUSH_PULL = BMP5_INTR_PUSH_PULL, ///< Push-pull output
BMP5XX_INTERRUPT_PUSH_PULL = BMP5_INTR_PUSH_PULL, ///< Push-pull output
BMP5XX_INTERRUPT_OPEN_DRAIN = BMP5_INTR_OPEN_DRAIN ///< Open-drain output
} bmp5xx_interrupt_drive_t;
@ -149,63 +152,67 @@ typedef enum {
* @brief Interrupt source settings (can be combined with bitwise OR)
*/
typedef enum {
BMP5XX_INTERRUPT_DATA_READY = 0x01, ///< Data ready interrupt
BMP5XX_INTERRUPT_FIFO_FULL = 0x02, ///< FIFO full interrupt
BMP5XX_INTERRUPT_DATA_READY = 0x01, ///< Data ready interrupt
BMP5XX_INTERRUPT_FIFO_FULL = 0x02, ///< FIFO full interrupt
BMP5XX_INTERRUPT_FIFO_THRESHOLD = 0x04, ///< FIFO threshold interrupt
BMP5XX_INTERRUPT_PRESSURE_OUT_OF_RANGE = 0x08 ///< Pressure out of range interrupt
BMP5XX_INTERRUPT_PRESSURE_OUT_OF_RANGE =
0x08 ///< Pressure out of range interrupt
} bmp5xx_interrupt_source_t;
/**
* @brief Adafruit Unified Sensor interface for temperature component of BMP5xx
*/
class Adafruit_BMP5xx_Temp : public Adafruit_Sensor {
public:
public:
/**
* @brief Construct a new Adafruit_BMP5xx_Temp object
*
* @param parent A pointer to the BMP5xx class
*/
Adafruit_BMP5xx_Temp(class Adafruit_BMP5xx *parent) { _theBMP5xx = parent; }
Adafruit_BMP5xx_Temp(class Adafruit_BMP5xx* parent) {
_theBMP5xx = parent;
}
bool getEvent(sensors_event_t *event);
void getSensor(sensor_t *sensor);
bool getEvent(sensors_event_t* event);
void getSensor(sensor_t* sensor);
private:
private:
int _sensorID = 0x580; /**< ID number for temperature sensor */
class Adafruit_BMP5xx *_theBMP5xx = NULL; /**< Pointer to BMP5xx instance */
class Adafruit_BMP5xx* _theBMP5xx = NULL; /**< Pointer to BMP5xx instance */
};
/**
* @brief Adafruit Unified Sensor interface for pressure component of BMP5xx
*/
class Adafruit_BMP5xx_Pressure : public Adafruit_Sensor {
public:
public:
/**
* @brief Construct a new Adafruit_BMP5xx_Pressure object
*
* @param parent A pointer to the BMP5xx class
*/
Adafruit_BMP5xx_Pressure(class Adafruit_BMP5xx *parent) { _theBMP5xx = parent; }
Adafruit_BMP5xx_Pressure(class Adafruit_BMP5xx* parent) {
_theBMP5xx = parent;
}
bool getEvent(sensors_event_t *event);
void getSensor(sensor_t *sensor);
bool getEvent(sensors_event_t* event);
void getSensor(sensor_t* sensor);
private:
private:
int _sensorID = 0x581; /**< ID number for pressure sensor */
class Adafruit_BMP5xx *_theBMP5xx = NULL; /**< Pointer to BMP5xx instance */
class Adafruit_BMP5xx* _theBMP5xx = NULL; /**< Pointer to BMP5xx instance */
};
/**
* Driver for the Adafruit BMP5xx barometric pressure sensor.
*/
class Adafruit_BMP5xx {
public:
public:
Adafruit_BMP5xx();
~Adafruit_BMP5xx(void);
bool begin(uint8_t addr = BMP5XX_DEFAULT_ADDRESS, TwoWire *theWire = &Wire);
bool begin(int8_t cspin, SPIClass *theSPI = &SPI);
bool begin(uint8_t addr = BMP5XX_DEFAULT_ADDRESS, TwoWire* theWire = &Wire);
bool begin(int8_t cspin, SPIClass* theSPI = &SPI);
float readTemperature(void);
float readPressure(void);
@ -225,55 +232,55 @@ public:
bmp5xx_odr_t getOutputDataRate(void);
bmp5xx_powermode_t getPowerMode(void);
Adafruit_Sensor *getTemperatureSensor(void);
Adafruit_Sensor *getPressureSensor(void);
Adafruit_Sensor* getTemperatureSensor(void);
Adafruit_Sensor* getPressureSensor(void);
bool enablePressure(bool enable = true);
bool dataReady(void);
bool configureInterrupt(bmp5xx_interrupt_mode_t mode,
bool configureInterrupt(bmp5xx_interrupt_mode_t mode,
bmp5xx_interrupt_polarity_t polarity,
bmp5xx_interrupt_drive_t drive,
bmp5xx_interrupt_drive_t drive,
uint8_t sources = BMP5XX_INTERRUPT_DATA_READY,
bool enable = true);
/**! Temperature (Celsius) assigned after calling performReading() */
float temperature;
/**! Pressure (hPa) assigned after calling performReading() */
/**! Pressure (hPa) assigned after calling performReading() */
float pressure;
private:
private:
bool _init(void);
/**! BMP5xx device struct from Bosch API */
struct bmp5_dev _bmp5_dev;
/**! Configuration struct for OSR/ODR settings */
struct bmp5_osr_odr_press_config _osr_odr_config;
/**! Configuration struct for IIR filter settings */
struct bmp5_iir_config _iir_config;
/**! I2C interface object */
Adafruit_I2CDevice *_i2c_dev = NULL;
Adafruit_I2CDevice* _i2c_dev = NULL;
/**! SPI interface object */
Adafruit_SPIDevice *_spi_dev = NULL;
Adafruit_SPIDevice* _spi_dev = NULL;
/**! Adafruit unified sensor interface for temperature */
Adafruit_BMP5xx_Temp *_temp_sensor = NULL;
Adafruit_BMP5xx_Temp* _temp_sensor = NULL;
/**! Adafruit unified sensor interface for pressure */
Adafruit_BMP5xx_Pressure *_pressure_sensor = NULL;
Adafruit_BMP5xx_Pressure* _pressure_sensor = NULL;
// Static callback functions for Bosch API
static int8_t i2c_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len,
void *intf_ptr);
static int8_t i2c_write(uint8_t reg_addr, const uint8_t *reg_data,
uint32_t len, void *intf_ptr);
static int8_t spi_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len,
void *intf_ptr);
static int8_t spi_write(uint8_t reg_addr, const uint8_t *reg_data,
uint32_t len, void *intf_ptr);
static void delay_usec(uint32_t us, void *intf_ptr);
static int8_t i2c_read(uint8_t reg_addr, uint8_t* reg_data, uint32_t len,
void* intf_ptr);
static int8_t i2c_write(uint8_t reg_addr, const uint8_t* reg_data,
uint32_t len, void* intf_ptr);
static int8_t spi_read(uint8_t reg_addr, uint8_t* reg_data, uint32_t len,
void* intf_ptr);
static int8_t spi_write(uint8_t reg_addr, const uint8_t* reg_data,
uint32_t len, void* intf_ptr);
static void delay_usec(uint32_t us, void* intf_ptr);
};
#endif // ADAFRUIT_BMP5XX_H

View file

@ -1,40 +1,40 @@
/**
* Copyright (c) 2021 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:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* @file bmp5.h
* @date 2021-08-27
* @version v1.0.5
*
*/
* Copyright (c) 2021 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:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* @file bmp5.h
* @date 2021-08-27
* @version v1.0.5
*
*/
/*!
* @defgroup bmp5 BMP5
@ -72,9 +72,9 @@ extern "C" {
* \code
* int8_t bmp5_init(struct bmp5_dev *dev);
* \endcode
* @details This API is the entry point. Call this API before using all other APIs.
* This API reads the chip-id of the sensor and sets the resolution, feature
* length and the type of variant.
* @details This API is the entry point. Call this API before using all other
* APIs. This API reads the chip-id of the sensor and sets the resolution,
* feature length and the type of variant.
*
* @param[in,out] dev : Structure instance of bmp5_dev.
*
@ -83,7 +83,7 @@ extern "C" {
* @return < 0 -> Fail
*
*/
int8_t bmp5_init(struct bmp5_dev *dev);
int8_t bmp5_init(struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -95,8 +95,8 @@ int8_t bmp5_init(struct bmp5_dev *dev);
* \ingroup bmp5ApiRegister
* \page bmp5_api_bmp5_get_regs bmp5_get_regs
* \code
* int8_t bmp5_get_regs(uint8_t reg_addr, uint8_t *data, uint32_t len, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_get_regs(uint8_t reg_addr, uint8_t *data, uint32_t len, struct
* bmp5_dev *dev); \endcode
* @details This API reads the data from the given register address of sensor.
*
* @param[in] reg_addr : Register address from where the data to be read.
@ -108,14 +108,15 @@ int8_t bmp5_init(struct bmp5_dev *dev);
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_regs(uint8_t reg_addr, uint8_t *data, uint32_t len, struct bmp5_dev *dev);
int8_t bmp5_get_regs(uint8_t reg_addr, uint8_t* data, uint32_t len,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiRegister
* \page bmp5_api_bmp5_set_regs bmp5_set_regs
* \code
* int8_t bmp5_set_regs(uint8_t reg_addr, const uint8_t *data, uint32_t len, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_set_regs(uint8_t reg_addr, const uint8_t *data, uint32_t len,
* struct bmp5_dev *dev); \endcode
* @details This API writes the given data to the register address of sensor.
*
* @param[in] reg_addr : Register address where the data is to be written.
@ -128,7 +129,8 @@ int8_t bmp5_get_regs(uint8_t reg_addr, uint8_t *data, uint32_t len, struct bmp5_
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_set_regs(uint8_t reg_addr, const uint8_t *data, uint32_t len, struct bmp5_dev *dev);
int8_t bmp5_set_regs(uint8_t reg_addr, const uint8_t* data, uint32_t len,
struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -142,7 +144,8 @@ int8_t bmp5_set_regs(uint8_t reg_addr, const uint8_t *data, uint32_t len, struct
* \code
* int8_t bmp5_soft_reset(struct bmp5_dev *dev);
* \endcode
* @details This API is used to soft-reset the sensor where all the registers are reset to their default values.
* @details This API is used to soft-reset the sensor where all the registers
* are reset to their default values.
*
* @note If this register is set using I2C, an ACK will NOT be transmitted to
* the host.
@ -153,7 +156,7 @@ int8_t bmp5_set_regs(uint8_t reg_addr, const uint8_t *data, uint32_t len, struct
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_soft_reset(struct bmp5_dev *dev);
int8_t bmp5_soft_reset(struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -167,8 +170,9 @@ int8_t bmp5_soft_reset(struct bmp5_dev *dev);
* \code
* int8_t bmp5_get_interrupt_status(uint8_t *int_status, struct bmp5_dev *dev);
* \endcode
* @details This API is used to get the interrupt status (data ready interrupt, fifo full interrupt,
* fifo threshold interrupt, pressure out of range interrupt and power-on reset/software reset complete interrupt).
* @details This API is used to get the interrupt status (data ready interrupt,
*fifo full interrupt, fifo threshold interrupt, pressure out of range interrupt
*and power-on reset/software reset complete interrupt).
*
* @param[out] int_status : Variable to store interrupt status.
* @param[in] dev : Structure instance of bmp5_dev.
@ -181,15 +185,16 @@ int8_t bmp5_soft_reset(struct bmp5_dev *dev);
* BMP5_INT_ASSERTED_DRDY | Data ready interrupt asserted
* BMP5_INT_ASSERTED_FIFO_FULL | Fifo full interrupt asserted
* BMP5_INT_ASSERTED_FIFO_THRES | Fifo threshold interrupt asserted
* BMP5_INT_ASSERTED_PRESSURE_OOR | Pressure out of range interrupt asserted
* BMP5_INT_ASSERTED_POR_SOFTRESET_COMPLETE | Power-on reset/Software reset complete interrupt asserted
* BMP5_INT_ASSERTED_PRESSURE_OOR | Pressure out of range interrupt
*asserted BMP5_INT_ASSERTED_POR_SOFTRESET_COMPLETE | Power-on reset/Software
*reset complete interrupt asserted
*@endverbatim
*
* @return Result of API execution status.
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_interrupt_status(uint8_t *int_status, struct bmp5_dev *dev);
int8_t bmp5_get_interrupt_status(uint8_t* int_status, struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -201,8 +206,8 @@ int8_t bmp5_get_interrupt_status(uint8_t *int_status, struct bmp5_dev *dev);
* \ingroup bmp5ApiPowermode
* \page bmp5_api_bmp5_set_power_mode bmp5_set_power_mode
* \code
* int8_t bmp5_set_power_mode(enum bmp5_powermode powermode, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_set_power_mode(enum bmp5_powermode powermode, struct bmp5_dev
**dev); \endcode
* @details This API sets the power mode of the sensor.
*
* @param[in] powermode : Select powermode.
@ -224,14 +229,14 @@ int8_t bmp5_get_interrupt_status(uint8_t *int_status, struct bmp5_dev *dev);
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_set_power_mode(enum bmp5_powermode powermode, struct bmp5_dev *dev);
int8_t bmp5_set_power_mode(enum bmp5_powermode powermode, struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiPowermode
* \page bmp5_api_bmp5_get_power_mode bmp5_get_power_mode
* \code
* int8_t bmp5_get_power_mode(enum bmp5_powermode *powermode, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_get_power_mode(enum bmp5_powermode *powermode, struct bmp5_dev
**dev); \endcode
* @details This API gets the power mode of the sensor.
*
* @param[out] powermode : To store the power mode.
@ -253,7 +258,8 @@ int8_t bmp5_set_power_mode(enum bmp5_powermode powermode, struct bmp5_dev *dev);
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_power_mode(enum bmp5_powermode *powermode, struct bmp5_dev *dev);
int8_t bmp5_get_power_mode(enum bmp5_powermode* powermode,
struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -266,26 +272,30 @@ int8_t bmp5_get_power_mode(enum bmp5_powermode *powermode, struct bmp5_dev *dev)
* \page bmp5_api_bmp5_get_sensor_data bmp5_get_sensor_data
* \code
* int8_t bmp5_get_sensor_data(struct bmp5_sensor_data *sensor_data,
* const struct bmp5_osr_odr_press_config *osr_odr_press_cfg, struct bmp5_dev *dev);
* \endcode
* @details This API reads the temperature(deg C) or both pressure(Pa) and temperature(deg C) data from the
* sensor and store it in the bmp5_sensor_data structure instance passed by the user.
* const struct bmp5_osr_odr_press_config
* *osr_odr_press_cfg, struct bmp5_dev *dev); \endcode
* @details This API reads the temperature(deg C) or both pressure(Pa) and
* temperature(deg C) data from the sensor and store it in the bmp5_sensor_data
* structure instance passed by the user.
*
* @param[out] sensor_data : Structure instance of bmp5_sensor_data.
* @param[in] osr_odr_press_cfg : Structure instance of bmp5_osr_odr_press_config.
* @param[in] osr_odr_press_cfg : Structure instance of
* bmp5_osr_odr_press_config.
* @param[in] dev : Structure instance of bmp5_dev.
*
* @note If fixed point(BMP5_USE_FIXED_POINT) is selected then data return type is uin64_t for pressure
* and int64_t for temperature. While for floating point(BMP5_USE_FLOATING_POINT) data return type is float for
* pressure and temperature.
* @note If fixed point(BMP5_USE_FIXED_POINT) is selected then data return type
* is uin64_t for pressure and int64_t for temperature. While for floating
* point(BMP5_USE_FLOATING_POINT) data return type is float for pressure and
* temperature.
*
* @return Result of API execution status.
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_sensor_data(struct bmp5_sensor_data *sensor_data,
const struct bmp5_osr_odr_press_config *osr_odr_press_cfg,
struct bmp5_dev *dev);
int8_t bmp5_get_sensor_data(
struct bmp5_sensor_data* sensor_data,
const struct bmp5_osr_odr_press_config* osr_odr_press_cfg,
struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -297,10 +307,10 @@ int8_t bmp5_get_sensor_data(struct bmp5_sensor_data *sensor_data,
* \ingroup bmp5ApiInterrupt
* \page bmp5_api_bmp5_int_source_select bmp5_int_source_select
* \code
* int8_t bmp5_int_source_select(const struct bmp5_int_source_select *int_source_select, struct bmp5_dev *dev);
* \endcode
* @details This API is used to enable the interrupts(drdy interrupt, fifo full interrupt,
* fifo threshold enable and pressure data out of range interrupt).
* int8_t bmp5_int_source_select(const struct bmp5_int_source_select
* *int_source_select, struct bmp5_dev *dev); \endcode
* @details This API is used to enable the interrupts(drdy interrupt, fifo full
* interrupt, fifo threshold enable and pressure data out of range interrupt).
*
* @param[in] int_source_select : Structure instance of bmp5_int_enable.
* @param[in] dev : Structure instance of bmp5_dev.
@ -309,7 +319,9 @@ int8_t bmp5_get_sensor_data(struct bmp5_sensor_data *sensor_data,
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_int_source_select(const struct bmp5_int_source_select *int_source_select, struct bmp5_dev *dev);
int8_t bmp5_int_source_select(
const struct bmp5_int_source_select* int_source_select,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiInterrupt
@ -337,7 +349,7 @@ int8_t bmp5_configure_interrupt(enum bmp5_intr_mode int_mode,
enum bmp5_intr_polarity int_pol,
enum bmp5_intr_drive int_od,
enum bmp5_intr_en_dis int_en,
struct bmp5_dev *dev);
struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -349,47 +361,54 @@ int8_t bmp5_configure_interrupt(enum bmp5_intr_mode int_mode,
* \ingroup bmp5ApiSettings
* \page bmp5_api_bmp5_get_osr_odr_press_config bmp5_get_osr_odr_press_config
* \code
* int8_t bmp5_get_osr_odr_press_config(struct bmp5_osr_odr_press_config *osr_odr_press_cfg, struct bmp5_dev *dev);
* \endcode
* @details This API gets the configuration for oversampling of temperature, oversampling of
* pressure and ODR configuration for normal mode along with pressure enable.
* int8_t bmp5_get_osr_odr_press_config(struct bmp5_osr_odr_press_config
* *osr_odr_press_cfg, struct bmp5_dev *dev); \endcode
* @details This API gets the configuration for oversampling of temperature,
* oversampling of pressure and ODR configuration for normal mode along with
* pressure enable.
*
* @param[out] osr_odr_press_cfg : Structure instance of bmp5_osr_odr_press_config.
* @param[out] osr_odr_press_cfg : Structure instance of
* bmp5_osr_odr_press_config.
* @param[in] dev : Structure instance of bmp5_dev.
*
* @return Result of API execution status.
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_osr_odr_press_config(struct bmp5_osr_odr_press_config *osr_odr_press_cfg, struct bmp5_dev *dev);
int8_t bmp5_get_osr_odr_press_config(
struct bmp5_osr_odr_press_config* osr_odr_press_cfg, struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiSettings
* \page bmp5_api_bmp5_set_osr_odr_press_config bmp5_set_osr_odr_press_config
* \code
* int8_t bmp5_set_osr_odr_press_config(const struct bmp5_osr_odr_press_config *osr_odr_press_cfg, struct bmp5_dev *dev);
* \endcode
* @details This API sets the configuration for oversampling of temperature, oversampling of
* pressure and ODR configuration along with pressure enable.
* int8_t bmp5_set_osr_odr_press_config(const struct bmp5_osr_odr_press_config
* *osr_odr_press_cfg, struct bmp5_dev *dev); \endcode
* @details This API sets the configuration for oversampling of temperature,
* oversampling of pressure and ODR configuration along with pressure enable.
*
* @param[in] osr_odr_press_cfg : Structure instance of bmp5_osr_odr_press_config.
* @param[in] osr_odr_press_cfg : Structure instance of
* bmp5_osr_odr_press_config.
* @param[in] dev : Structure instance of bmp5_dev.
*
* @note If ODR is set to a value higher than 5Hz then powermode is set as standby mode, as ODR value greater than 5HZ
* without disabling deep-standby mode makes powermode invalid.
* @note If ODR is set to a value higher than 5Hz then powermode is set as
* standby mode, as ODR value greater than 5HZ without disabling deep-standby
* mode makes powermode invalid.
*
* @return Result of API execution status.
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_set_osr_odr_press_config(const struct bmp5_osr_odr_press_config *osr_odr_press_cfg, struct bmp5_dev *dev);
int8_t bmp5_set_osr_odr_press_config(
const struct bmp5_osr_odr_press_config* osr_odr_press_cfg,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiSettings
* \page bmp5_api_bmp5_get_iir_config bmp5_get_iir_config
* \code
* int8_t bmp5_get_iir_config(struct bmp5_iir_config *iir_cfg, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_get_iir_config(struct bmp5_iir_config *iir_cfg, struct bmp5_dev
* *dev); \endcode
* @details This API gets the configuration for IIR of temperature and pressure.
*
* @param[out] iir_cfg : Structure instance of bmp5_iir_config.
@ -399,22 +418,24 @@ int8_t bmp5_set_osr_odr_press_config(const struct bmp5_osr_odr_press_config *osr
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_iir_config(struct bmp5_iir_config *iir_cfg, struct bmp5_dev *dev);
int8_t bmp5_get_iir_config(struct bmp5_iir_config* iir_cfg,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiSettings
* \page bmp5_api_bmp5_set_iir_config bmp5_set_iir_config
* \code
* int8_t bmp5_set_iir_config(const struct bmp5_iir_config *iir_cfg, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_set_iir_config(const struct bmp5_iir_config *iir_cfg, struct
* bmp5_dev *dev); \endcode
* @details This API sets the configuration for IIR of temperature and pressure.
*
* @note
* 1. The IIR configuration can be performed only in standby mode. So in this API before updating IIR
* configuration powermode is switched to standby mode and reverted back to earlier powermode after
* IIR configuration is updated.
* 2. If IIR value for both temperature and pressure is set a value other than bypass then powermode is set
* as standby mode, as IIR with value other than bypass without disabling deep-standby mode makes powermode invalid.
* 1. The IIR configuration can be performed only in standby mode. So in this
* API before updating IIR configuration powermode is switched to standby mode
* and reverted back to earlier powermode after IIR configuration is updated.
* 2. If IIR value for both temperature and pressure is set a value other than
* bypass then powermode is set as standby mode, as IIR with value other than
* bypass without disabling deep-standby mode makes powermode invalid.
*
* @param[in] iir_cfg : Structure instance of bmp5_iir_config.
* @param[in] dev : Structure instance of bmp5_dev.
@ -423,14 +444,15 @@ int8_t bmp5_get_iir_config(struct bmp5_iir_config *iir_cfg, struct bmp5_dev *dev
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_set_iir_config(const struct bmp5_iir_config *iir_cfg, struct bmp5_dev *dev);
int8_t bmp5_set_iir_config(const struct bmp5_iir_config* iir_cfg,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiSettings
* \page bmp5_api_bmp5_get_osr_odr_eff bmp5_get_osr_odr_eff
* \code
* int8_t bmp5_get_osr_odr_eff(struct bmp5_osr_odr_eff *osr_odr_eff, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_get_osr_odr_eff(struct bmp5_osr_odr_eff *osr_odr_eff, struct
* bmp5_dev *dev); \endcode
* @details This API gets the configuration for effective OSR of temperature,
* effective OSR of pressure and ODR valid status.
*
@ -441,7 +463,8 @@ int8_t bmp5_set_iir_config(const struct bmp5_iir_config *iir_cfg, struct bmp5_de
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_osr_odr_eff(struct bmp5_osr_odr_eff *osr_odr_eff, struct bmp5_dev *dev);
int8_t bmp5_get_osr_odr_eff(struct bmp5_osr_odr_eff* osr_odr_eff,
struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -453,8 +476,8 @@ int8_t bmp5_get_osr_odr_eff(struct bmp5_osr_odr_eff *osr_odr_eff, struct bmp5_de
* \ingroup bmp5ApiFIFO
* \page bmp5_api_bmp5_get_fifo_configuration bmp5_get_fifo_configuration
* \code
* int8_t bmp5_get_fifo_configuration(struct bmp5_fifo *fifo, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_get_fifo_configuration(struct bmp5_fifo *fifo, struct bmp5_dev
* *dev); \endcode
* @details This API used to get the configurations of fifo from the sensor.
*
* @param[out] fifo : Structure instance of bmp5_fifo.
@ -464,34 +487,37 @@ int8_t bmp5_get_osr_odr_eff(struct bmp5_osr_odr_eff *osr_odr_eff, struct bmp5_de
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_fifo_configuration(struct bmp5_fifo *fifo, struct bmp5_dev *dev);
int8_t bmp5_get_fifo_configuration(struct bmp5_fifo* fifo,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiFIFO
* \page bmp5_api_bmp5_set_fifo_configuration bmp5_set_fifo_configuration
* \code
* int8_t bmp5_set_fifo_configuration(const struct bmp5_fifo *fifo, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_set_fifo_configuration(const struct bmp5_fifo *fifo, struct
* bmp5_dev *dev); \endcode
* @details This API used to set the configurations of fifo in the sensor.
*
* @param[in] fifo : Structure instance of bmp5_fifo.
* @param[in] dev : Structure instance of bmp5_dev.
*
* @note If Fifo frame selection is enabled then powermode is set as standby mode, as fifo frame selection
* enabled without disabling deep-standby mode makes powermode invalid.
* @note If Fifo frame selection is enabled then powermode is set as standby
* mode, as fifo frame selection enabled without disabling deep-standby mode
* makes powermode invalid.
*
* @return Result of API execution status.
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_set_fifo_configuration(const struct bmp5_fifo *fifo, struct bmp5_dev *dev);
int8_t bmp5_set_fifo_configuration(const struct bmp5_fifo* fifo,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiFIFO
* \page bmp5_api_bmp5_get_fifo_len bmp5_get_fifo_len
* \code
* int8_t bmp5_get_fifo_len(uint8_t *fifo_len, struct bmp5_fifo *fifo, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_get_fifo_len(uint8_t *fifo_len, struct bmp5_fifo *fifo, struct
* bmp5_dev *dev); \endcode
* @details This API is used to get the length of fifo from the sensor.
*
* @param[out] fifo_len : Variable to store fifo length.
@ -502,7 +528,8 @@ int8_t bmp5_set_fifo_configuration(const struct bmp5_fifo *fifo, struct bmp5_dev
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_fifo_len(uint16_t *fifo_len, struct bmp5_fifo *fifo, struct bmp5_dev *dev);
int8_t bmp5_get_fifo_len(uint16_t* fifo_len, struct bmp5_fifo* fifo,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiFIFO
@ -519,16 +546,16 @@ int8_t bmp5_get_fifo_len(uint16_t *fifo_len, struct bmp5_fifo *fifo, struct bmp5
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_fifo_data(struct bmp5_fifo *fifo, struct bmp5_dev *dev);
int8_t bmp5_get_fifo_data(struct bmp5_fifo* fifo, struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiFIFO
* \page bmp5_api_bmp5_extract_fifo_data bmp5_extract_fifo_data
* \code
* int8_t bmp5_extract_fifo_data(const struct bmp5_fifo *fifo, struct bmp5_sensor_data *sensor_data);
* \endcode
* @details This API extract the temperature and/or pressure data from the fifo data which is
* already read from the fifo.
* int8_t bmp5_extract_fifo_data(const struct bmp5_fifo *fifo, struct
* bmp5_sensor_data *sensor_data); \endcode
* @details This API extract the temperature and/or pressure data from the fifo
* data which is already read from the fifo.
*
* @param[in] fifo : Structure instance of bmp5_fifo.
* @param[out] sensor_data : Structure instance of bmp5_sensor_data.
@ -538,7 +565,8 @@ int8_t bmp5_get_fifo_data(struct bmp5_fifo *fifo, struct bmp5_dev *dev);
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_extract_fifo_data(const struct bmp5_fifo *fifo, struct bmp5_sensor_data *sensor_data);
int8_t bmp5_extract_fifo_data(const struct bmp5_fifo* fifo,
struct bmp5_sensor_data* sensor_data);
/**
* \ingroup bmp5
@ -550,37 +578,43 @@ int8_t bmp5_extract_fifo_data(const struct bmp5_fifo *fifo, struct bmp5_sensor_d
* \ingroup bmp5ApiOOR
* \page bmp5_api_bmp5_get_oor_configuration bmp5_get_oor_configuration
* \code
* int8_t bmp5_get_oor_configuration(struct bmp5_oor_press_configuration *oor_press_config, struct bmp5_dev *dev);
* \endcode
* @details This API gets the configuration for out-of-range pressure threshold, range
* count limit and IIR.
* int8_t bmp5_get_oor_configuration(struct bmp5_oor_press_configuration
* *oor_press_config, struct bmp5_dev *dev); \endcode
* @details This API gets the configuration for out-of-range pressure threshold,
* range count limit and IIR.
*
* @param[out] oor_press_config : Structure instance of bmp5_oor_press_configuration.
* @param[out] oor_press_config : Structure instance of
* bmp5_oor_press_configuration.
* @param[in] dev : Structure instance of bmp5_dev.
*
* @return Result of API execution status.
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_get_oor_configuration(struct bmp5_oor_press_configuration *oor_press_config, struct bmp5_dev *dev);
int8_t bmp5_get_oor_configuration(
struct bmp5_oor_press_configuration* oor_press_config,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiOOR
* \page bmp5_api_bmp5_set_oor_configuration bmp5_set_oor_configuration
* \code
* int8_t bmp5_set_oor_configuration(const struct bmp5_oor_press_configuration *oor_press_config, struct bmp5_dev *dev);
* \endcode
* @details This API sets the configuration for out-of-range pressure threshold, range
* count limit and IIR.
* int8_t bmp5_set_oor_configuration(const struct bmp5_oor_press_configuration
* *oor_press_config, struct bmp5_dev *dev); \endcode
* @details This API sets the configuration for out-of-range pressure threshold,
* range count limit and IIR.
*
* @param[in] oor_press_config : Structure instance of bmp5_oor_press_configuration.
* @param[in] oor_press_config : Structure instance of
* bmp5_oor_press_configuration.
* @param[in] dev : Structure instance of bmp5_dev.
*
* @return Result of API execution status.
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_set_oor_configuration(const struct bmp5_oor_press_configuration *oor_press_config, struct bmp5_dev *dev);
int8_t bmp5_set_oor_configuration(
const struct bmp5_oor_press_configuration* oor_press_config,
struct bmp5_dev* dev);
/**
* \ingroup bmp5
@ -592,8 +626,8 @@ int8_t bmp5_set_oor_configuration(const struct bmp5_oor_press_configuration *oor
* \ingroup bmp5ApiNVM
* \page bmp5_api_bmp5_nvm_read bmp5_nvm_read
* \code
* int8_t bmp5_nvm_read(uint8_t nvm_addr, uint16_t *nvm_data, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_nvm_read(uint8_t nvm_addr, uint16_t *nvm_data, struct bmp5_dev
* *dev); \endcode
* @details This API is used to perform NVM read.
*
* @param[in] nvm_addr : Variable that holds the nvm address.
@ -604,14 +638,15 @@ int8_t bmp5_set_oor_configuration(const struct bmp5_oor_press_configuration *oor
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_nvm_read(uint8_t nvm_addr, uint16_t *nvm_data, struct bmp5_dev *dev);
int8_t bmp5_nvm_read(uint8_t nvm_addr, uint16_t* nvm_data,
struct bmp5_dev* dev);
/*!
* \ingroup bmp5ApiNVM
* \page bmp5_api_bmp5_nvm_write bmp5_nvm_write
* \code
* int8_t bmp5_nvm_write(uint8_t nvm_addr, const uint16_t *nvm_data, struct bmp5_dev *dev);
* \endcode
* int8_t bmp5_nvm_write(uint8_t nvm_addr, const uint16_t *nvm_data, struct
* bmp5_dev *dev); \endcode
* @details This API used to perform NVM write.
*
* @param[in] nvm_addr : Variable that holds the nvm address.
@ -622,7 +657,8 @@ int8_t bmp5_nvm_read(uint8_t nvm_addr, uint16_t *nvm_data, struct bmp5_dev *dev)
* @return 0 -> Success
* @return < 0 -> Fail
*/
int8_t bmp5_nvm_write(uint8_t nvm_addr, const uint16_t *nvm_data, struct bmp5_dev *dev);
int8_t bmp5_nvm_write(uint8_t nvm_addr, const uint16_t* nvm_data,
struct bmp5_dev* dev);
#ifdef __cplusplus
}

File diff suppressed because it is too large Load diff