Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX30101 max32630fthr
Fork of MAX30101_Demo_Plot by
Diff: main.cpp
- Revision:
- 7:6075af57668e
- Parent:
- 6:238d2eec53de
- Child:
- 8:a1538e8a3fd9
--- a/main.cpp Tue Aug 29 20:32:39 2017 +0000
+++ b/main.cpp Tue Sep 05 14:11:26 2017 +0000
@@ -69,7 +69,7 @@
uint8_t fifoData[MAX30101::MAX_FIFO_BYTES];
uint16_t idx, readBytes;
- int16_t opSample;
+ int32_t opSample;
uint32_t sample;
while(1) {
@@ -92,7 +92,8 @@
// Convert read bytes into samples
for(idx = 0; idx < readBytes; idx+=3) {
sample = (fifoData[idx]<<16) | (fifoData[idx+1]<<8) | (fifoData[idx+2]);
- opSample = sample >> 8; // Sign extends sample to 16-bit opSample
+ opSample = sample << 14; // Sign extends sample
+ opSample = opSample >> 14;
pc.printf("%i\r\n", opSample); // Print results
}
@@ -152,8 +153,8 @@
if(rc == 0)
{
spo2Config.all = 0;
- spo2Config.bits.spo2_sr = MAX30101::SR_400_Hz; // SpO2 SR = 400Hz
- spo2Config.bits.led_pw = 1; // 16-bit ADC resolution
+ spo2Config.bits.spo2_sr = MAX30101::SR_3200_Hz; // SpO2 SR = 1600Hz
+ spo2Config.bits.led_pw = MAX30101::PW_3; // 18-bit ADC resolution
rc = op_sensor.setSpO2Configuration(spo2Config);
}
