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.
Revision 5:04ca5f370db0, committed 2019-12-04
- Comitter:
- robo1340
- Date:
- Wed Dec 04 19:15:47 2019 +0000
- Parent:
- 4:5273ab1085ab
- Commit message:
- changed baud rate
Changed in this revision
| MAX30102/MAX30102.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5273ab1085ab -r 04ca5f370db0 MAX30102/MAX30102.cpp --- a/MAX30102/MAX30102.cpp Thu May 19 22:04:06 2016 +0000 +++ b/MAX30102/MAX30102.cpp Wed Dec 04 19:15:47 2019 +0000 @@ -59,11 +59,14 @@ #include "mbed.h" #include "MAX30102.h" +I2C i2c(p28, p27); +/* #ifdef TARGET_MAX32600MBED I2C i2c(I2C1_SDA, I2C1_SCL); #else I2C i2c(I2C_SDA, I2C_SCL); #endif +*/ bool maxim_max30102_write_reg(uint8_t uch_addr, uint8_t uch_data) /**
diff -r 5273ab1085ab -r 04ca5f370db0 main.cpp
--- a/main.cpp Thu May 19 22:04:06 2016 +0000
+++ b/main.cpp Wed Dec 04 19:15:47 2019 +0000
@@ -87,17 +87,8 @@
uint8_t uch_dummy;
Serial pc(USBTX, USBRX); //initializes the serial port
-#ifdef TARGET_KL25Z
-PwmOut led(PTB18); //initializes the pwm output that connects to the on board LED
-DigitalIn INT(PTD1); //pin PTD1 connects to the interrupt output pin of the MAX30102
-#endif
-#ifdef TARGET_K64F
-DigitalIn INT(PTD1); //pin PTD1 connects to the interrupt output pin of the MAX30102
-#endif
-#ifdef TARGET_MAX32600MBED
-PwmOut led(LED_RED); //initializes the pwm output that connects to the on board LED
-DigitalIn INT(P2_0); //pin P20 connects to the interrupt output pin of the MAX30102
-#endif
+PwmOut led(LED1); //initializes the pwm output that connects to the on board LED
+DigitalIn INT(p26); //pin P20 connects to the interrupt output pin of the MAX30102
// the setup routine runs once when you press reset:
int main() {
@@ -108,8 +99,8 @@
maxim_max30102_reset(); //resets the MAX30102
// initialize serial communication at 115200 bits per second:
- pc.baud(115200);
- pc.format(8,SerialBase::None,1);
+ //pc.baud(115200);
+ //pc.format(8,SerialBase::None,1);
wait(1);
//read and clear status register
@@ -144,10 +135,12 @@
un_min=aun_red_buffer[i]; //update signal min
if(un_max<aun_red_buffer[i])
un_max=aun_red_buffer[i]; //update signal max
- pc.printf("red=");
- pc.printf("%i", aun_red_buffer[i]);
- pc.printf(", ir=");
- pc.printf("%i\n\r", aun_ir_buffer[i]);
+ if ((i%100)==0){
+ pc.printf("red=");
+ pc.printf("%i", aun_red_buffer[i]);
+ pc.printf(", ir=");
+ pc.printf("%i\n\r", aun_ir_buffer[i]);
+ }
}
un_prev_data=aun_red_buffer[i];
@@ -203,15 +196,17 @@
#if defined(TARGET_KL25Z) || defined(TARGET_MAX32600MBED)
led.write(1-(float)n_brightness/256);
#endif
- //send samples and calculation result to terminal program through UART
- pc.printf("red=");
- pc.printf("%i", aun_red_buffer[i]);
- pc.printf(", ir=");
- pc.printf("%i", aun_ir_buffer[i]);
- pc.printf(", HR=%i, ", n_heart_rate);
- pc.printf("HRvalid=%i, ", ch_hr_valid);
- pc.printf("SpO2=%i, ", n_sp02);
- pc.printf("SPO2Valid=%i\n\r", ch_spo2_valid);
+ if ((i%100)==0){
+ //send samples and calculation result to terminal program through UART
+ pc.printf("red=");
+ pc.printf("%i", aun_red_buffer[i]);
+ pc.printf(", ir=");
+ pc.printf("%i", aun_ir_buffer[i]);
+ pc.printf(", HR=%i, ", n_heart_rate);
+ pc.printf("HRvalid=%i, ", ch_hr_valid);
+ pc.printf("SpO2=%i, ", n_sp02);
+ pc.printf("SPO2Valid=%i\n\r", ch_spo2_valid);
+ }
}
maxim_heart_rate_and_oxygen_saturation(aun_ir_buffer, n_ir_buffer_length, aun_red_buffer, &n_sp02, &ch_spo2_valid, &n_heart_rate, &ch_hr_valid);
}