Solaris Software
Loading...
Searching...
No Matches
bmp390.c File Reference
#include "spp/services/bmp390/bmp390.h"
#include "spp/hal/spi/spi.h"
#include "spp/hal/time/time.h"
#include "spp/services/log/log.h"
#include "spp/services/databank/databank.h"
#include "spp/core/packet.h"
#include "spp/core/pubsub/pubsub.h"
#include "spp/services/fsm/fsm.h"
#include <string.h>
#include <math.h>
Include dependency graph for bmp390.c:

Go to the source code of this file.

Macros

#define K_BMP390_TASK_TIMEOUT_MS   5000U
#define K_BMP390_TAG   "BMP390"
#define K_BMP390_PERFORMANCE_SAMPLES   (10000U)

Functions

static SPP_RetVal_t SPP_SERVICES_BMP390_init (void)
 BMP390 sensor instance initialisation. This function is called by the service task. It is responsible for initialising the SPI bus, the GPIO ISR, and the sensor driver.
static SPP_RetVal_t SPP_SERVICES_BMP390_acquireData (SPP_Kpid_t kpid)
 Acquisition callback invoked by the SPP service task on each cycle.
static SPP_RetVal_t SPP_SERVICES_BMP390_softReset (void *p_spiHandler)
 Sends a soft-reset command to the sensor and waits 100 ms for it to reboot.
static SPP_RetVal_t SPP_SERVICES_BMP390_enableSpiMode (void *p_spiHandler)
 Writes the interface-config register to lock the sensor into SPI mode.
static SPP_RetVal_t SPP_SERVICES_BMP390_configCheck (void *p_spiHandler)
 Reads the chip-ID register and returns an error if the value is not 0x60.
static SPP_RetVal_t SPP_SERVICES_BMP390_auxConfig (void *p_spiHandler)
 Resets the sensor, enables SPI mode, and verifies the chip ID.
static SPP_RetVal_t SPP_SERVICES_BMP390_prepareMeasure (void *p_spiHandler)
 Writes OSR, ODR, IIR and power-control registers to start continuous measurements.
static SPP_RetVal_t SPP_SERVICES_BMP390_readRawTempCoeffs (void *p_spiHandler, BMP390_temp_calib_t *tcalib)
 Polls the DRDY flag until set or until the timeout elapses.
static SPP_RetVal_t SPP_SERVICES_BMP390_calibrateTempParams (void *p_spiHandler, BMP390_temp_params_t *out)
 Reads raw temperature coefficients and scales them to floating-point parameters.
static SPP_RetVal_t SPP_SERVICES_BMP390_readRawTemp (void *p_spiHandler, uint32_t *raw_temp)
 Reads the 24-bit raw temperature ADC value from the sensor.
static float SPP_SERVICES_BMP390_compensateTemperature (spp_uint32_t raw_temp, BMP390_temp_params_t *params)
 Applies the BMP390 double-quadratic temperature compensation formula.
static SPP_RetVal_t SPP_SERVICES_BMP390_auxGetTemp (void *p_spiHandler, const BMP390_temp_params_t *temp_params, spp_uint32_t *raw_temp, float *comp_temp)
 Reads the raw temperature ADC and returns the compensated value.
static SPP_RetVal_t SPP_SERVICES_BMP390_readRawPressCoeffs (void *p_spiHandler, BMP390_press_calib_t *pcalib)
 Reads raw pressure calibration coefficients from the sensor's NVM registers.
static SPP_RetVal_t SPP_SERVICES_BMP390_calibratePressParams (void *p_spiHandler, BMP390_press_params_t *out)
 Reads raw pressure coefficients and scales them to floating-point parameters.
static SPP_RetVal_t SPP_SERVICES_BMP390_readRawPress (void *p_spiHandler, spp_uint32_t *raw_press)
 Reads the 24-bit raw pressure ADC value from the sensor.
static float SPP_SERVICES_BMP390_compensatePressure (spp_uint32_t raw_press, float t_lin, BMP390_press_params_t *p)
 Applies the BMP390 pressure compensation formula using the linearised temperature.
static SPP_RetVal_t SPP_SERVICES_BMP390_auxGetPress (void *p_spiHandler, const BMP390_press_params_t *press_params, float t_lin, spp_uint32_t *raw_press, float *comp_press)
 Reads raw pressure ADC and returns the compensated value in Pa.
static SPP_RetVal_t SPP_SERVICES_BMP390_getAltitude (void *p_spiHandler, float *altitude_m, float *pressure_pa, float *temperature_c)
 Reads compensated altitude, pressure and temperature from the sensor.
static SPP_RetVal_t SPP_SERVICES_BMP390_intEnableDrdy (void *p_spiHandler)
 Enables the active-high data-ready interrupt output on the sensor.
const SPP_SERVICE_ProducerContract_t * SPP_SERVICES_BMP390_getProducerContract (void)

Variables

static const SPP_SERVICE_ProducerContract_t g_bmp390ProducerContract
static BMP390_t s_bmpData
static const char *const k_svcTag = "BMP_SVC"
static float s_pd1
static float s_pd2
static float s_pd3
static float s_pd4
static float s_po1
static float s_po2
static float s_compPress

Macro Definition Documentation

◆ K_BMP390_TASK_TIMEOUT_MS

#define K_BMP390_TASK_TIMEOUT_MS   5000U

Definition at line 29 of file bmp390.c.

◆ K_BMP390_TAG

#define K_BMP390_TAG   "BMP390"

Definition at line 30 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_acquireData(), and SPP_SERVICES_BMP390_configCheck().

◆ K_BMP390_PERFORMANCE_SAMPLES

#define K_BMP390_PERFORMANCE_SAMPLES   (10000U)

Definition at line 59 of file bmp390.c.

Function Documentation

◆ SPP_SERVICES_BMP390_init()

SPP_RetVal_t SPP_SERVICES_BMP390_init ( void )
static

BMP390 sensor instance initialisation. This function is called by the service task. It is responsible for initialising the SPI bus, the GPIO ISR, and the sensor driver.

Parameters
p_dataPointer to the BMP390 sensor instance.
Returns
K_SPP_OK on success.

Definition at line 122 of file bmp390.c.

References BMP390_GpioConfig_t::drdyFlag, BMP390_t::gpioConfig, BMP390_GpioConfig_t::intIntrType, BMP390_GpioConfig_t::intPin, BMP390_GpioConfig_t::intPull, BMP390_GpioConfig_t::isrCtx, K_BMP390_INT_INTR_TYPE, K_BMP390_INT_PIN_NUM, K_BMP390_INT_PULL, K_BMP390_SPI_BUS_IDX, K_SPP_ERROR, K_SPP_OK, SPP_GpioIsrCtx_t::p_flag, BMP390_SpiConfig_t::p_spiHandler, s_bmpData, BMP390_t::spiConfig, BMP390_SpiConfig_t::spiDevIdx, SPP_HAL_GPIO_configInterrupt(), SPP_HAL_GPIO_registerIsr(), SPP_HAL_SPI_deviceInit(), SPP_HAL_SPI_getHandle(), SPP_SERVICES_BMP390_auxConfig(), SPP_SERVICES_BMP390_init(), SPP_SERVICES_BMP390_intEnableDrdy(), and SPP_SERVICES_BMP390_prepareMeasure().

Referenced by SPP_SERVICES_BMP390_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_acquireData()

SPP_RetVal_t SPP_SERVICES_BMP390_acquireData ( SPP_Kpid_t kpid)
static

Acquisition callback invoked by the SPP service task on each cycle.

Checks the DRDY flag, reads compensated altitude, pressure and temperature from the sensor, packs the values into an SPP packet and publishes it. Silently returns if DRDY is not set or no free packet is available.

Parameters
p_dataPointer to the BMP390_t sensor instance.

Definition at line 174 of file bmp390.c.

References BMP390_GpioConfig_t::drdyFlag, BMP390_t::gpioConfig, K_BMP390_TAG, K_SPP_ERROR, K_SPP_OK, k_svcTag, BMP390_SpiConfig_t::p_spiHandler, s_bmpData, BMP390_t::seq, BMP390_t::spiConfig, SPP_LOGE, SPP_LOGI, SPP_LOGW, SPP_Packet_t, SPP_SERVICES_BMP390_acquireData(), SPP_SERVICES_BMP390_getAltitude(), SPP_SERVICES_DATABANK_getPacket(), SPP_SERVICES_DATABANK_packetData(), SPP_SERVICES_DATABANK_returnPacket(), SPP_SERVICES_PUBSUB_publish(), and SPP_Kpid_t::value.

Referenced by SPP_SERVICES_BMP390_acquireData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_softReset()

SPP_RetVal_t SPP_SERVICES_BMP390_softReset ( void * p_spiHandler)
static

Sends a soft-reset command to the sensor and waits 100 ms for it to reboot.

Parameters
p_spiHandlerSPI device handle.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 258 of file bmp390.c.

References BMP390_SOFT_RESET_CMD, K_BMP390_SOFT_RESET_REG, SPP_HAL_SPI_transmit(), SPP_HAL_TIME_delayMs(), and SPP_SERVICES_BMP390_softReset().

Referenced by SPP_SERVICES_BMP390_auxConfig(), and SPP_SERVICES_BMP390_softReset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_enableSpiMode()

SPP_RetVal_t SPP_SERVICES_BMP390_enableSpiMode ( void * p_spiHandler)
static

Writes the interface-config register to lock the sensor into SPI mode.

Parameters
p_spiHandlerSPI device handle.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 271 of file bmp390.c.

References BMP390_IF_CONF_SPI, K_BMP390_IF_CONF_REG, SPP_HAL_SPI_transmit(), SPP_HAL_TIME_delayMs(), and SPP_SERVICES_BMP390_enableSpiMode().

Referenced by SPP_SERVICES_BMP390_auxConfig(), and SPP_SERVICES_BMP390_enableSpiMode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_configCheck()

SPP_RetVal_t SPP_SERVICES_BMP390_configCheck ( void * p_spiHandler)
static

Reads the chip-ID register and returns an error if the value is not 0x60.

Parameters
p_spiHandlerSPI device handle.
Returns
K_SPP_OK if chip ID matches, K_SPP_ERROR otherwise.

Definition at line 284 of file bmp390.c.

References K_BMP390_CHIP_ID_REG, K_BMP390_IF_CONF_REG, K_BMP390_SOFT_RESET_REG, K_BMP390_SPI_READ, K_BMP390_SPI_WRITE, K_BMP390_TAG, K_SPP_ERROR, K_SPP_OK, SPP_HAL_SPI_transmit(), SPP_LOGE, SPP_LOGI, and SPP_SERVICES_BMP390_configCheck().

Referenced by SPP_SERVICES_BMP390_auxConfig(), and SPP_SERVICES_BMP390_configCheck().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_auxConfig()

SPP_RetVal_t SPP_SERVICES_BMP390_auxConfig ( void * p_spiHandler)
static

Resets the sensor, enables SPI mode, and verifies the chip ID.

Parameters
p_spiHandlerSPI device handle.
Returns
K_SPP_OK on success, K_SPP_ERROR if any step fails.

Definition at line 313 of file bmp390.c.

References K_SPP_OK, SPP_SERVICES_BMP390_auxConfig(), SPP_SERVICES_BMP390_configCheck(), SPP_SERVICES_BMP390_enableSpiMode(), and SPP_SERVICES_BMP390_softReset().

Referenced by SPP_SERVICES_BMP390_auxConfig(), and SPP_SERVICES_BMP390_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_prepareMeasure()

SPP_RetVal_t SPP_SERVICES_BMP390_prepareMeasure ( void * p_spiHandler)
static

Writes OSR, ODR, IIR and power-control registers to start continuous measurements.

Parameters
p_spiHandlerSPI device handle.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 343 of file bmp390.c.

References BMP390_VALUE_IIR, BMP390_VALUE_ODR, BMP390_VALUE_OSR, BMP390_VALUE_PWRCTRL, K_BMP390_REG_IIR, K_BMP390_REG_ODR, K_BMP390_REG_OSR, K_BMP390_REG_PWRCTRL, SPP_HAL_SPI_transmit(), and SPP_SERVICES_BMP390_prepareMeasure().

Referenced by SPP_SERVICES_BMP390_init(), and SPP_SERVICES_BMP390_prepareMeasure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_readRawTempCoeffs()

SPP_RetVal_t SPP_SERVICES_BMP390_readRawTempCoeffs ( void * p_spiHandler,
BMP390_temp_calib_t * tcalib )
static

Polls the DRDY flag until set or until the timeout elapses.

Parameters
p_bmpPointer to the driver context containing the ISR flag.
timeout_msMaximum time to wait in milliseconds.
Returns
K_SPP_OK when data is ready, K_SPP_ERROR on timeout.

Reads raw temperature calibration coefficients from the sensor's NVM registers.

Parameters
p_spiHandlerSPI device handle.
tcalibOutput struct populated with raw par_t1/t2/t3 values.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 370 of file bmp390.c.

References K_BMP390_SPI_READ, K_BMP390_SPI_WRITE, K_BMP390_TEMP_CALIB_REG_START, K_SPP_OK, BMP390_temp_calib_t::par_t1, BMP390_temp_calib_t::par_t2, BMP390_temp_calib_t::par_t3, SPP_HAL_SPI_transmit(), and SPP_SERVICES_BMP390_readRawTempCoeffs().

Referenced by SPP_SERVICES_BMP390_calibrateTempParams(), and SPP_SERVICES_BMP390_readRawTempCoeffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_calibrateTempParams()

SPP_RetVal_t SPP_SERVICES_BMP390_calibrateTempParams ( void * p_spiHandler,
BMP390_temp_params_t * out )
static

Reads raw temperature coefficients and scales them to floating-point parameters.

Parameters
p_spiHandlerSPI device handle.
outOutput struct populated with scaled PAR_T1/T2/T3.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 405 of file bmp390.c.

References K_SPP_OK, BMP390_temp_params_t::PAR_T1, BMP390_temp_calib_t::par_t1, BMP390_temp_params_t::PAR_T2, BMP390_temp_calib_t::par_t2, BMP390_temp_params_t::PAR_T3, BMP390_temp_calib_t::par_t3, SPP_SERVICES_BMP390_calibrateTempParams(), and SPP_SERVICES_BMP390_readRawTempCoeffs().

Referenced by SPP_SERVICES_BMP390_calibrateTempParams(), and SPP_SERVICES_BMP390_getAltitude().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_readRawTemp()

SPP_RetVal_t SPP_SERVICES_BMP390_readRawTemp ( void * p_spiHandler,
uint32_t * raw_temp )
static

Reads the 24-bit raw temperature ADC value from the sensor.

Parameters
p_spiHandlerSPI device handle.
raw_tempOutput: raw 24-bit ADC reading.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 428 of file bmp390.c.

References K_BMP390_SPI_READ, K_BMP390_SPI_WRITE, K_BMP390_TEMP_RAW_REG, K_SPP_OK, SPP_HAL_SPI_transmit(), and SPP_SERVICES_BMP390_readRawTemp().

Referenced by SPP_SERVICES_BMP390_auxGetTemp(), and SPP_SERVICES_BMP390_readRawTemp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_compensateTemperature()

float SPP_SERVICES_BMP390_compensateTemperature ( spp_uint32_t raw_temp,
BMP390_temp_params_t * params )
static

Applies the BMP390 double-quadratic temperature compensation formula.

Parameters
raw_tempRaw 24-bit ADC reading from the sensor.
paramsScaled calibration parameters (PAR_T1/T2/T3).
Returns
Compensated temperature in degrees Celsius (t_lin).

Definition at line 461 of file bmp390.c.

References BMP390_temp_params_t::PAR_T1, BMP390_temp_params_t::PAR_T2, BMP390_temp_params_t::PAR_T3, and SPP_SERVICES_BMP390_compensateTemperature().

Referenced by SPP_SERVICES_BMP390_auxGetTemp(), and SPP_SERVICES_BMP390_compensateTemperature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_auxGetTemp()

SPP_RetVal_t SPP_SERVICES_BMP390_auxGetTemp ( void * p_spiHandler,
const BMP390_temp_params_t * temp_params,
spp_uint32_t * raw_temp,
float * comp_temp )
static

Reads the raw temperature ADC and returns the compensated value.

Parameters
p_spiHandlerSPI device handle.
temp_paramsScaled calibration parameters.
raw_tempOutput: raw ADC reading.
comp_tempOutput: compensated temperature in °C.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 478 of file bmp390.c.

References K_SPP_OK, SPP_SERVICES_BMP390_auxGetTemp(), SPP_SERVICES_BMP390_compensateTemperature(), and SPP_SERVICES_BMP390_readRawTemp().

Referenced by SPP_SERVICES_BMP390_auxGetTemp(), and SPP_SERVICES_BMP390_getAltitude().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_readRawPressCoeffs()

SPP_RetVal_t SPP_SERVICES_BMP390_readRawPressCoeffs ( void * p_spiHandler,
BMP390_press_calib_t * pcalib )
static

Reads raw pressure calibration coefficients from the sensor's NVM registers.

Parameters
p_spiHandlerSPI device handle.
pcalibOutput struct populated with raw par_p1..p11 values.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 502 of file bmp390.c.

References K_BMP390_PRESS_CALIB_REG_START, K_BMP390_SPI_READ, K_BMP390_SPI_WRITE, K_SPP_OK, BMP390_press_calib_t::par_p1, BMP390_press_calib_t::par_p10, BMP390_press_calib_t::par_p11, BMP390_press_calib_t::par_p2, BMP390_press_calib_t::par_p3, BMP390_press_calib_t::par_p4, BMP390_press_calib_t::par_p5, BMP390_press_calib_t::par_p6, BMP390_press_calib_t::par_p7, BMP390_press_calib_t::par_p8, BMP390_press_calib_t::par_p9, SPP_HAL_SPI_transmit(), and SPP_SERVICES_BMP390_readRawPressCoeffs().

Referenced by SPP_SERVICES_BMP390_calibratePressParams(), and SPP_SERVICES_BMP390_readRawPressCoeffs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_calibratePressParams()

SPP_RetVal_t SPP_SERVICES_BMP390_calibratePressParams ( void * p_spiHandler,
BMP390_press_params_t * out )
static

Reads raw pressure coefficients and scales them to floating-point parameters.

Parameters
p_spiHandlerSPI device handle.
outOutput struct populated with scaled PAR_P1..P11.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 586 of file bmp390.c.

References K_SPP_OK, BMP390_press_params_t::PAR_P1, BMP390_press_calib_t::par_p1, BMP390_press_params_t::PAR_P10, BMP390_press_calib_t::par_p10, BMP390_press_params_t::PAR_P11, BMP390_press_calib_t::par_p11, BMP390_press_params_t::PAR_P2, BMP390_press_calib_t::par_p2, BMP390_press_params_t::PAR_P3, BMP390_press_calib_t::par_p3, BMP390_press_params_t::PAR_P4, BMP390_press_calib_t::par_p4, BMP390_press_params_t::PAR_P5, BMP390_press_calib_t::par_p5, BMP390_press_params_t::PAR_P6, BMP390_press_calib_t::par_p6, BMP390_press_params_t::PAR_P7, BMP390_press_calib_t::par_p7, BMP390_press_params_t::PAR_P8, BMP390_press_calib_t::par_p8, BMP390_press_params_t::PAR_P9, BMP390_press_calib_t::par_p9, SPP_SERVICES_BMP390_calibratePressParams(), and SPP_SERVICES_BMP390_readRawPressCoeffs().

Referenced by SPP_SERVICES_BMP390_calibratePressParams(), and SPP_SERVICES_BMP390_getAltitude().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_readRawPress()

SPP_RetVal_t SPP_SERVICES_BMP390_readRawPress ( void * p_spiHandler,
spp_uint32_t * raw_press )
static

Reads the 24-bit raw pressure ADC value from the sensor.

Parameters
p_spiHandlerSPI device handle.
raw_pressOutput: raw 24-bit ADC reading.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 617 of file bmp390.c.

References K_BMP390_PRESS_RAW_REG, K_BMP390_SPI_READ, K_BMP390_SPI_WRITE, K_SPP_OK, SPP_HAL_SPI_transmit(), and SPP_SERVICES_BMP390_readRawPress().

Referenced by SPP_SERVICES_BMP390_auxGetPress(), and SPP_SERVICES_BMP390_readRawPress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_compensatePressure()

float SPP_SERVICES_BMP390_compensatePressure ( spp_uint32_t raw_press,
float t_lin,
BMP390_press_params_t * p )
static

Applies the BMP390 pressure compensation formula using the linearised temperature.

Parameters
raw_pressRaw 24-bit ADC pressure reading.
t_linLinearised (compensated) temperature in °C.
pScaled pressure calibration parameters.
Returns
Compensated pressure in Pa.

Definition at line 651 of file bmp390.c.

References BMP390_press_params_t::PAR_P1, BMP390_press_params_t::PAR_P10, BMP390_press_params_t::PAR_P11, BMP390_press_params_t::PAR_P2, BMP390_press_params_t::PAR_P3, BMP390_press_params_t::PAR_P4, BMP390_press_params_t::PAR_P5, BMP390_press_params_t::PAR_P6, BMP390_press_params_t::PAR_P7, BMP390_press_params_t::PAR_P8, BMP390_press_params_t::PAR_P9, s_compPress, s_pd1, s_pd2, s_pd3, s_pd4, s_po1, s_po2, and SPP_SERVICES_BMP390_compensatePressure().

Referenced by SPP_SERVICES_BMP390_auxGetPress(), and SPP_SERVICES_BMP390_compensatePressure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_auxGetPress()

SPP_RetVal_t SPP_SERVICES_BMP390_auxGetPress ( void * p_spiHandler,
const BMP390_press_params_t * press_params,
float t_lin,
spp_uint32_t * raw_press,
float * comp_press )
static

Reads raw pressure ADC and returns the compensated value in Pa.

Parameters
p_spiHandlerSPI device handle.
press_paramsScaled pressure calibration parameters.
t_linLinearised temperature used for pressure compensation.
raw_pressOutput: raw 24-bit ADC reading.
comp_pressOutput: compensated pressure in Pa.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 682 of file bmp390.c.

References K_SPP_OK, SPP_SERVICES_BMP390_auxGetPress(), SPP_SERVICES_BMP390_compensatePressure(), and SPP_SERVICES_BMP390_readRawPress().

Referenced by SPP_SERVICES_BMP390_auxGetPress(), and SPP_SERVICES_BMP390_getAltitude().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_getAltitude()

SPP_RetVal_t SPP_SERVICES_BMP390_getAltitude ( void * p_spiHandler,
float * altitude_m,
float * pressure_pa,
float * temperature_c )
static

Reads compensated altitude, pressure and temperature from the sensor.

Parameters
p_spiHandlerSPI device handle.
p_bmpDriver context (unused; DRDY is handled by the caller).
altitude_mOutput: altitude in metres (barometric formula, ref 1013.25 hPa).
pressure_paOutput: compensated pressure in Pa.
temperature_cOutput: compensated temperature in °C.
Returns
K_SPP_OK on success, K_SPP_ERROR_NULL_POINTER if any pointer is NULL, K_SPP_ERROR on SPI failure.

Definition at line 710 of file bmp390.c.

References K_SPP_ERROR_NULL_POINTER, K_SPP_OK, SPP_SERVICES_BMP390_auxGetPress(), SPP_SERVICES_BMP390_auxGetTemp(), SPP_SERVICES_BMP390_calibratePressParams(), SPP_SERVICES_BMP390_calibrateTempParams(), and SPP_SERVICES_BMP390_getAltitude().

Referenced by SPP_SERVICES_BMP390_acquireData(), and SPP_SERVICES_BMP390_getAltitude().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_intEnableDrdy()

SPP_RetVal_t SPP_SERVICES_BMP390_intEnableDrdy ( void * p_spiHandler)
static

Enables the active-high data-ready interrupt output on the sensor.

Parameters
p_spiHandlerSPI device handle.
Returns
K_SPP_OK on success, K_SPP_ERROR on SPI failure.

Definition at line 772 of file bmp390.c.

References K_BMP390_INT_CTRL_DRDY_EN, K_BMP390_INT_CTRL_LEVEL, K_BMP390_REG_INT_CTRL, SPP_HAL_SPI_transmit(), and SPP_SERVICES_BMP390_intEnableDrdy().

Referenced by SPP_SERVICES_BMP390_init(), and SPP_SERVICES_BMP390_intEnableDrdy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SPP_SERVICES_BMP390_getProducerContract()

const SPP_SERVICE_ProducerContract_t * SPP_SERVICES_BMP390_getProducerContract ( void )

Definition at line 87 of file bmp390.c.

References g_bmp390ProducerContract, and SPP_SERVICES_BMP390_getProducerContract().

Referenced by CUSTOM_registerConsumerProducer(), and SPP_SERVICES_BMP390_getProducerContract().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_bmp390ProducerContract

const SPP_SERVICE_ProducerContract_t g_bmp390ProducerContract
static
Initial value:
= {.p_nameProducer = "bmp390",
#define K_BMP390_TASK_TIMEOUT_MS
Definition bmp390.c:29
static SPP_RetVal_t SPP_SERVICES_BMP390_init(void)
BMP390 sensor instance initialisation. This function is called by the service task....
Definition bmp390.c:122
static SPP_RetVal_t SPP_SERVICES_BMP390_acquireData(SPP_Kpid_t kpid)
Acquisition callback invoked by the SPP service task on each cycle.
Definition bmp390.c:174

Definition at line 74 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_getProducerContract().

◆ s_bmpData

BMP390_t s_bmpData
static

Definition at line 78 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_acquireData(), and SPP_SERVICES_BMP390_init().

◆ k_svcTag

const char* const k_svcTag = "BMP_SVC"
static

Definition at line 79 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_acquireData().

◆ s_pd1

float s_pd1
static

Definition at line 80 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_compensatePressure().

◆ s_pd2

float s_pd2
static

Definition at line 80 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_compensatePressure().

◆ s_pd3

float s_pd3
static

Definition at line 80 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_compensatePressure().

◆ s_pd4

float s_pd4
static

Definition at line 80 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_compensatePressure().

◆ s_po1

float s_po1
static

Definition at line 81 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_compensatePressure().

◆ s_po2

float s_po2
static

Definition at line 81 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_compensatePressure().

◆ s_compPress

float s_compPress
static

Definition at line 82 of file bmp390.c.

Referenced by SPP_SERVICES_BMP390_compensatePressure().