Dependencies:   max32630fthr Adafruit_FeatherOLED_2020 USBDevice

Revision:
4:727e58d27bf1
Parent:
3:bb52b351d6f5
Child:
5:f18d3d0fe600
--- a/source/main.cpp	Thu Feb 13 16:35:33 2020 +0000
+++ b/source/main.cpp	Fri Feb 14 11:10:19 2020 +0000
@@ -16,6 +16,7 @@
 
 #include <events/mbed_events.h>
 #include <mbed.h>
+#include "max32630fthr.h"
 #include "Adafruit_SSD1306.h"//include the adafruit library for the oled display
 #include "ble/BLE.h"
 #include "ble/Gap.h"
@@ -28,6 +29,7 @@
 
 
 DigitalOut led2(LED2, 1);
+MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
 
 uint32_t aun_ir_buffer[500]; //IR LED sensor data
 int32_t n_ir_buffer_length;    //data length
@@ -42,10 +44,8 @@
 int32_t n_brightness;
 float f_temp;
 uint8_t hrmCounter;
-
-I2C i2c(P3_4, P3_5); // SDA, SCL
-
-Adafruit_SSD1306_I2c oled(i2c); //declare the oled display and its port connection type (I2C)
+I2C I2c(P3_4, P3_5); // SDA, SCL
+Adafruit_SSD1306_I2c oled(I2c); 
 
 #ifdef TARGET_MAX32630FTHR
 PwmOut led1(LED_RED);    //initializes the pwm output that connects to the on board LED
@@ -198,7 +198,7 @@
 
 
 void HRMSensorInitialise(){
-        maxim_max30102_reset(); //resets the MAX30102
+    maxim_max30102_reset(); //resets the MAX30102
 
     
     //read and clear status register
@@ -232,6 +232,8 @@
     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); 
 }
 
+
+
 void HRMSensorTask(){
         eventQueue.call_every(500, periodicCallback);
  
@@ -241,10 +243,27 @@
         
         eventQueue.dispatch_forever();
 }
+
+
+
+
+
+
+
+
 void OLEDInitialise(){
+    Thread::wait(50);  // Give the supplies time to settle before initializing the display
     oled.clearDisplay();
-    oled.setTextCursor();
-    oled.setTextSize();
+    oled.display();
+    oled.setTextSize(2);
+}
+
+void OLEDTask(){
+    Thread::wait(500);
+        oled.clearDisplay();
+        oled.setTextCursor(0,0); 
+        oled.printf("BPM: 50");
+        oled.display();
 }
 
 int main()
@@ -255,7 +274,7 @@
     
     while(1)
     {
-        
+        OLEDTask();
         HRMSensorTask();