![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
First try
Dependencies: BLE_API BLE_Driver I2C_Driver MAX30100 millis mbed nRF51822
Fork of BLE_Driver_Example by
Revision 3:cb0290a123d2, committed 2017-05-30
- Comitter:
- Ferszt
- Date:
- Tue May 30 00:20:34 2017 +0000
- Parent:
- 2:065060bb55f2
- Commit message:
- commit 1
Changed in this revision
diff -r 065060bb55f2 -r cb0290a123d2 MAX30100.lib --- a/MAX30100.lib Tue Mar 28 02:08:37 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/teams/TESIS-SATUROMETRICA/code/MAX30100/#c8da8e2afe09
diff -r 065060bb55f2 -r cb0290a123d2 MAX30100_RaivisStrogonovs.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MAX30100_RaivisStrogonovs.lib Tue May 30 00:20:34 2017 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/TESIS-SATUROMETRICA/code/MAX30100/#d0a8a423beeb
diff -r 065060bb55f2 -r cb0290a123d2 PROCESAMIENTO_DATOS_SP02.lib --- a/PROCESAMIENTO_DATOS_SP02.lib Tue Mar 28 02:08:37 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/teams/TESIS-SATUROMETRICA/code/PROCESAMIENTO_DATOS_SP02/#7e5b24227d0a
diff -r 065060bb55f2 -r cb0290a123d2 mainSECONDtry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mainSECONDtry.cpp Tue May 30 00:20:34 2017 +0000 @@ -0,0 +1,85 @@ +#include "mbed.h" +#include "Ticker.h" +#include "BLE_Driver.h" +#include "MAX30100_RaivisStrogonovs.h" +#include "I2C_Driver.h" +#include "millis.h" + +#define nRF51DK +//#define nRF52DK + + +#ifdef nRF52DK +#define SCL 28 +#define SDA 29 +#endif + +#ifdef nRF51DK +#define SCL 7 +#define SDA 6 +#endif + + +InterruptIn SMPRDY(p1); +DigitalOut LIVE_LED(p21, 1); +DigitalOut CONECT_LED(p22, 1); +DigitalOut TEST_LED(p23, 1); +DigitalOut LED(p24, 1); +DigitalIn TEST_BUTTON(p17,PullUp); + +Ticker Flasher; +MAX30100* pulseOxymeter; + +char show[10]; + +void callbackBLE(int event) { + switch (event){ + case 1: CONECT_LED = 1; break; + case 2: CONECT_LED = 0; break; + default: break; + } + } + +void periodicCallback(void){ + uint8_t a; + a = getBLE(); + } + +int main(void){ + millisStart(); + pulseoxymeter_t result; + //SMPRDY.fall(&sample); + Flasher.attach(periodicCallback, 1); + ini_i2c(SCL, SDA); + iniBLE("Sigfried"); + pulseOxymeter = new MAX30100( DEFAULT_OPERATING_MODE, DEFAULT_SAMPLING_RATE, DEFAULT_LED_PULSE_WIDTH, DEFAULT_IR_LED_CURRENT, true, true ); + while(1){ + result = pulseOxymeter->update(); + + if( result.pulseDetected == true ) + { + putBLE("Registers: \n"); + putBLE("BEAT"); + + putBLE( "BPM: " ); + sprintf(show, "%f", result.heartBPM ); + putBLE(show); + putBLE( " | " ); + + putBLE( "SaO2: " ); + sprintf(show, "%f", result.SaO2 ); + putBLE(show); + putBLE( "%" ); + + putBLE("{P2|BPM|255,40,0|"); + sprintf(show, "%f", result.heartBPM ); + putBLE(show); + putBLE("|SaO2|0,0,255|"); + sprintf(show, "%f", result.SaO2 ); + putBLE(show); + putBLE("}"); + } + } + } + +
diff -r 065060bb55f2 -r cb0290a123d2 mainbletest.cpp --- a/mainbletest.cpp Tue Mar 28 02:08:37 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -#include "mbed.h" -#include "Ticker.h" -#include "BLE_Driver.h" -#include "MAX30100.h" -#include "I2C_Driver.h" -#include "PROCESAMIENTO_SPO2_FC.h" - -#define nRF51DK -//#define nRF52DK - - -#ifdef nRF52DK -#define SCL 28 -#define SDA 29 -#endif - -#ifdef nRF51DK -#define SCL 7 -#define SDA 6 -#endif - -//************************** -int muestras_RED[200]; -int muestras_IR[200]; -int samples_index = 0; -int max_min_period[2]; -int pico_pico,cresta, valle, cantidad; -float frecuencia,periodo; - -int index, aux1, nmuestra; - - char show[10]; - -//****************** - -DigitalOut LIVE_LED(p17, 1); -DigitalOut CONECT_LED(p18, 1); -DigitalOut TEST_LED(p19, 1); -DigitalOut LED(p20, 1); -DigitalIn TEST_BUTTON(p13,PullUp); - -Ticker Flasher; -MAX30100 sensor; - -void callbackBLE(int event) { - switch (event){ - case 1: CONECT_LED = 1; break; - case 2: CONECT_LED = 0; break; - default: break; - } - } - -void periodicCallback(void){ - LIVE_LED =! LIVE_LED; - } - -void store_Samples(void){ - if (samples_index == 200){ - periodo = valores(muestras_IR,max_min_period); - frecuencia=60/(periodo*0.02); - samples_index = 0; - sprintf(show, "%f", frecuencia); - putBLE(show); - putBLE("\n"); - } - else{ - muestras_RED[samples_index] = sensor.RED; - muestras_IR[samples_index] = sensor.IR; - sprintf(show, "%d", muestras_IR[samples_index]); - putBLE(show); - putBLE("\n"); - samples_index++; - } -} -int main(void){ - Flasher.attach(periodicCallback, 1); - ini_i2c(SCL, SDA); - sensor.begin(pw1600, i17, sr50 ); - iniBLE("Sigfried"); - while(1){ - sensor.readSensor(); - store_Samples(); - wait(0.019); - - } - } - -
diff -r 065060bb55f2 -r cb0290a123d2 millis.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/millis.lib Tue May 30 00:20:34 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/hudakz/code/millis/#ac7586424119