fw/drivers: add BMP390 barometer driver and pressure/altitude API#1068
fw/drivers: add BMP390 barometer driver and pressure/altitude API#1068mkoperator wants to merge 3 commits into
Conversation
Implement full BMP390 barometer driver with I2C communication, calibration data parsing, and configurable oversampling/filtering. Add pressure service applib layer exposing barometric pressure (Pa) and altitude (cm) to watchapps via the native SDK. Includes: - BMP390 driver: init, forced-mode reads, compensation math per datasheet - Pressure service: subscribe/unsubscribe, caching, ISA altitude calc - I2C burst read support for nRF5 platform - Console command for live pressure/altitude readout - Exported symbols for native SDK integration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pressure service functions are exported via the SDK jump table but ran in unprivileged app context, crashing when stored apps tried to access hardware drivers. Wrap all exported functions with DEFINE_SYSCALL and add a sys_pressure_read_and_compute syscall for the timer callback path. Also register the altimeter stored app in the system app registry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gmarull
left a comment
There was a problem hiding this comment.
split changes into small chunks that can be reviewed easily, and follow commit guidelines.
| // Buffer for combining register address + write data into a single TX transfer. | ||
| // TXTX (two-part TX) on nRF52840 can fail to transmit the secondary buffer | ||
| // correctly due to TWIM peripheral errata. Using a single TX avoids this. | ||
| #define I2C_WRITE_BUF_MAX 32 | ||
| static uint8_t s_write_buf[I2C_WRITE_BUF_MAX]; |
There was a problem hiding this comment.
red flag: static buffer shared for all instances, "peripheral errata", please, explain which one, and why doesn't nrfx cover it?
I appreciate your warm welcome. Do you have anything more specific about how you would like these split? and as far as commit guidelines, only one I see is the signed off by on commits. Am I missing anything else? |
- Protect BMP390 reads/writes with a mutex for thread safety - Move nRF5 I2C write buffer from static global to per-bus state (errata coredevices#219 workaround now safe for multi-bus configs) - Add PressureFilterMode enum and pressure_set_filter_mode() driver API - Decouple IIR filter config from ODR presets — filter mode is now independently controllable - Add pressure_service_set_filter_mode() applib syscall + SDK export - Add BMP390 unit tests with fake I2C layer - Add standalone altimeter app skeleton Signed-off-by: Mikhail Kozorovitskiy <misha@mkoperator.com>
re splitting: i.e. split driver and api into seperate commits, altimeter app should be its own commit as well i.e. re: commit guidelines dunno if thats exactly wrong but the email address you used to commit doesnt seem to reflect/link to your github account |
Adds support for the BMP390 barometric pressure sensor and exposes pressure/altitude data to watchapps through a new applib service.