diff options
| author | mark9064 <30447455+mark9064@users.noreply.github.com> | 2024-09-21 23:29:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-22 00:29:15 +0200 |
| commit | ad3bf49c7b2864d8f06cedea8ad329e26360f297 (patch) | |
| tree | 265651ee7009a9f8117e12f02dc90b399dbee24d /src/components/heartrate | |
| parent | 7ca0418c82173fa1cff9537eaf1f030b5a712e9a (diff) | |
Atomic HRS reads (#1845)
- Combine the reading of all `HRS3300` registers into one I2C read so data is not partial
- Downsizes both HRS and ALS to 16bit as the sensor does not generate larger than
16bit values in its current configuration
- Increasing the resolution by 1 bit doubles the sensor acquisition time,
since we are already at 10Hz we are never going to use a higher resolution
- The PPG algorithm buffers for ALS/HRS are already 16bit anyway
- Remove functions for setting gain / drive that are unused throughout the codebase
- Calculate constants with constexpr
Diffstat (limited to 'src/components/heartrate')
| -rw-r--r-- | src/components/heartrate/Ppg.cpp | 2 | ||||
| -rw-r--r-- | src/components/heartrate/Ppg.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/components/heartrate/Ppg.cpp b/src/components/heartrate/Ppg.cpp index 3a6988ae..efbed852 100644 --- a/src/components/heartrate/Ppg.cpp +++ b/src/components/heartrate/Ppg.cpp @@ -142,7 +142,7 @@ Ppg::Ppg() { spectrum.fill(0.0f); } -int8_t Ppg::Preprocess(uint32_t hrs, uint32_t als) { +int8_t Ppg::Preprocess(uint16_t hrs, uint16_t als) { if (dataIndex < dataLength) { dataHRS[dataIndex++] = hrs; } diff --git a/src/components/heartrate/Ppg.h b/src/components/heartrate/Ppg.h index 4492b2c2..373e7985 100644 --- a/src/components/heartrate/Ppg.h +++ b/src/components/heartrate/Ppg.h @@ -14,7 +14,7 @@ namespace Pinetime { class Ppg { public: Ppg(); - int8_t Preprocess(uint32_t hrs, uint32_t als); + int8_t Preprocess(uint16_t hrs, uint16_t als); int HeartRate(); void Reset(bool resetDaqBuffer); static constexpr int deltaTms = 100; |
