BMP390 barometric pressure sensor driver and service. More...
#include <stdint.h>#include "spp/core/returnTypes.h"#include "spp/core/types.h"#include "spp/hal/gpio/gpio.h"#include "spp/services/service.h"Go to the source code of this file.
Data Structures | |
| struct | BMP390_temp_calib_t |
| Raw temperature calibration coefficients (as read from sensor). More... | |
| struct | BMP390_temp_params_t |
| Scaled temperature calibration parameters. More... | |
| struct | BMP390_press_calib_t |
| Raw pressure calibration coefficients. More... | |
| struct | BMP390_press_params_t |
| Scaled pressure calibration parameters. More... | |
| struct | BMP390_SpiConfig_t |
| struct | BMP390_GpioConfig_t |
| struct | BMP390_t |
| BMP390 sensor instance. More... | |
Functions | |
| const SPP_SERVICE_ProducerContract_t * | SPP_SERVICES_BMP390_getProducerContract (void) |
| spp_uint16_t | SPP_SERVICES_BMP390_getPerformanceSampleCount (void) |
| SPP_RetVal_t | SPP_SERVICES_BMP390_getPerformanceSample (spp_uint16_t index, spp_uint32_t *p_bmpUs, spp_uint32_t *p_tempSpiUs, spp_uint32_t *p_pressSpiUs) |
BMP390 barometric pressure sensor driver and service.
Provides SPI-based communication with the Bosch BMP390 sensor for reading calibrated temperature, pressure and derived altitude. Supports data-ready interrupt via GPIO event groups.
The driver follows a three-step workflow:
To use the SPP service registry, declare a BMP390_t with the hardware pin fields filled in, then call SPP_SERVICES_register() with g_bmp390Module.
Naming conventions used in this file:
Definition in file bmp390.h.
| #define K_BMP_SERVICE_TASK_PRIO (5U) |
| #define K_BMP_SERVICE_TASK_DELAY_MS (200U) |
| #define K_BMP_SERVICE_TASK_STACK_SIZE (4096U) |
| #define K_BMP_SERVICE_PAYLOAD_LEN (12U) |
| #define K_BMP390_SPI_READ 0x80U |
SPI read flag: OR with register address.
Definition at line 45 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_configCheck(), SPP_SERVICES_BMP390_readRawPress(), SPP_SERVICES_BMP390_readRawPressCoeffs(), SPP_SERVICES_BMP390_readRawTemp(), and SPP_SERVICES_BMP390_readRawTempCoeffs().
| #define K_BMP390_SPI_WRITE 0x00U |
SPI write flag: OR with register address.
Definition at line 46 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_configCheck(), SPP_SERVICES_BMP390_readRawPress(), SPP_SERVICES_BMP390_readRawPressCoeffs(), SPP_SERVICES_BMP390_readRawTemp(), and SPP_SERVICES_BMP390_readRawTempCoeffs().
| #define K_BMP390_PIN_NUM_CS 18U |
| #define K_BMP390_SPI_BUS_IDX 0U |
SPI bus index (informational; set by HAL).
Definition at line 48 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_init().
| #define K_BMP390_CHIP_ID_REG 0x00 |
Chip ID register address.
Definition at line 51 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_configCheck().
| #define K_BMP390_SOFT_RESET_REG 0x7E |
Soft-reset register address.
Definition at line 53 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_configCheck(), and SPP_SERVICES_BMP390_softReset().
| #define BMP390_SOFT_RESET_CMD 0xB6 |
Soft-reset command byte.
Definition at line 54 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_softReset().
| #define K_BMP390_IF_CONF_REG 0x1A |
Interface configuration register address.
Definition at line 55 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_configCheck(), and SPP_SERVICES_BMP390_enableSpiMode().
| #define BMP390_IF_CONF_SPI 0x00 |
SPI interface mode value.
Definition at line 56 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_enableSpiMode().
| #define K_BMP390_REG_PWRCTRL 0x1B |
Power control register address.
Definition at line 59 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_prepareMeasure().
| #define BMP390_VALUE_PWRCTRL 0x33 |
Power control value (temp+press on, normal mode).
Definition at line 60 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_prepareMeasure().
| #define K_BMP390_REG_OSR 0x1C |
Oversampling register address.
Definition at line 61 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_prepareMeasure().
| #define BMP390_VALUE_OSR 0x00 |
Oversampling value (no oversampling).
Definition at line 62 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_prepareMeasure().
| #define K_BMP390_REG_ODR 0x1D |
Output data rate register address.
Definition at line 63 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_prepareMeasure().
| #define BMP390_VALUE_ODR 0x01 |
Output data rate value.
Definition at line 64 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_prepareMeasure().
| #define K_BMP390_REG_IIR 0x1F |
IIR filter register address.
Definition at line 65 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_prepareMeasure().
| #define BMP390_VALUE_IIR 0x02 |
IIR filter coefficient value.
Definition at line 66 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_prepareMeasure().
| #define K_BMP390_STATUS_DRDY_TEMP 0x40 |
| #define BMP390_STATUS_DRDY_PRES 0x20 |
| #define K_BMP390_TEMP_CALIB_REG_START 0x31 |
Start address of temperature calibration regs.
Definition at line 74 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_readRawTempCoeffs().
| #define K_BMP390_TEMP_RAW_REG 0x07 |
Start address of raw temperature data regs.
Definition at line 75 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_readRawTemp().
| #define K_BMP390_DRDY_TIMEOUT_MS 5000U |
| #define K_BMP390_PRESS_CALIB_REG_START 0x36 |
Start address of pressure calibration regs.
Definition at line 79 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_readRawPressCoeffs().
| #define K_BMP390_PRESS_RAW_REG 0x04 |
Start address of raw pressure data regs.
Definition at line 80 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_readRawPress().
| #define K_BMP390_REG_INT_CTRL 0x19 |
Interrupt control register address.
Definition at line 83 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_intEnableDrdy().
| #define K_BMP390_INT_CTRL_DRDY_EN 0x40 |
Interrupt control: enable data-ready interrupt.
Definition at line 84 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_intEnableDrdy().
| #define K_BMP390_INT_CTRL_LEVEL 0x02 |
Interrupt control: active-high level.
Definition at line 85 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_intEnableDrdy().
| #define K_BMP390_INT_PIN_NUM 3U |
Interrupt GPIO pin
Definition at line 86 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_init().
| #define K_BMP390_INT_INTR_TYPE 1U |
Interrupt trigger type (1=rising).
Definition at line 87 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_init().
| #define K_BMP390_INT_PULL 0U |
Pull resistor: 0=none 1=up 2=down.
Definition at line 88 of file bmp390.h.
Referenced by SPP_SERVICES_BMP390_init().
| 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().
| spp_uint16_t SPP_SERVICES_BMP390_getPerformanceSampleCount | ( | void | ) |
References SPP_SERVICES_BMP390_getPerformanceSampleCount().
Referenced by SPP_SERVICES_BMP390_getPerformanceSampleCount().
| SPP_RetVal_t SPP_SERVICES_BMP390_getPerformanceSample | ( | spp_uint16_t | index, |
| spp_uint32_t * | p_bmpUs, | ||
| spp_uint32_t * | p_tempSpiUs, | ||
| spp_uint32_t * | p_pressSpiUs ) |
References SPP_SERVICES_BMP390_getPerformanceSample().
Referenced by SPP_SERVICES_BMP390_getPerformanceSample().