Team Project / Mbed OS FTHR_OLED_CodeForFTHR

Dependencies:   max32630fthr Adafruit_FeatherOLED USBDevice

Files at this revision

API Documentation at this revision

Comitter:
jonaangelica
Date:
Thu Feb 13 15:45:43 2020 +0000
Parent:
11:d58cc7ff04d4
Commit message:
commit;

Changed in this revision

Adafruit_FeatherOLED.lib 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
--- a/Adafruit_FeatherOLED.lib	Thu Feb 06 13:20:46 2020 +0000
+++ b/Adafruit_FeatherOLED.lib	Thu Feb 13 15:45:43 2020 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/switches/code/Adafruit_FeatherOLED/#e16d3a603d50
+https://os.mbed.com/teams/Team-Project/code/Adafruit_FeatherOLED/#035781c1290c
--- a/main.cpp	Thu Feb 06 13:20:46 2020 +0000
+++ b/main.cpp	Thu Feb 13 15:45:43 2020 +0000
@@ -38,7 +38,7 @@
 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
 
 I2C i2c(P3_4, P3_5); // SDA, SCL
-
+Adafruit_SSD1306_I2c oled(i2c); 
 // Hardware serial port over DAPLink
 Serial daplink(P2_1, P2_0);
 
@@ -63,6 +63,15 @@
 AnalogIn ain2(AIN_2); 
 AnalogIn ain3(AIN_3);
 
+void DisplayHeartRate(){
+    }
+    
+void Information(int inc){
+        oled.clearDisplay();
+        oled.setTextCursor(1,0);
+        oled.printf("BP: "+inc);
+    }
+
 
 // main() runs in its own thread in the OS
 // (note the calls to Thread::wait below for delays)
@@ -79,16 +88,16 @@
 
 
     Thread::wait(50);  // Give the supplies time to settle before initializing the display
-    Adafruit_SSD1306_I2c featherOLED(i2c);  
-    featherOLED.clearDisplay();
-    //featherOLED.printf("%ux%u OLED Display\r\n", featherOLED.width(), featherOLED.height());
-   // featherOLED.printf("HelloWorld \r");
-    featherOLED.display();
-    featherOLED.setTextSize(1);
-
+  //  Adafruit_SSD1306_I2c oled(i2c);  
+    oled.clearDisplay();
+    //oled.printf("%ux%u oled Display\r\n", oled.width(), oled.height());
+   // oled.printf("HelloWorld \r");
+    oled.display();
+    oled.setTextSize(2);
+    int inc = 0;
 
     while(1) {
-        Thread::wait(250);
+        Thread::wait(500);
 //        if (microUSB.readable()) {
 //            c = microUSB.getc();
 //            microUSB.putc(c);
@@ -102,14 +111,17 @@
 //        rLED = aButton;
 //        gLED = bButton;
 //        bLED = cButton;
-        featherOLED.clearDisplay();
-        featherOLED.setTextCursor(0,0); 
-        featherOLED.printf("MAX32630FTHR OLED\n");
-        featherOLED.printf("TEST CODE");
-//        featherOLED.printf("AIN0/1: %1.2f, %1.2f\n", (6.0f * ain0), (6.0f * ain1) );  // analog inputs 0,1
-//        featherOLED.printf("AIN2/3: %1.2f, %1.2f\n", (1.2f * ain2), (1.2f * ain3) );  // analog inputs 2,3
-//        featherOLED.printf("UART:%c  A:%d  B:%d  C:%d\n", c, aButton.read(), bButton.read(), cButton.read());  // UART and Buttons
-        featherOLED.display();
+        if(inc >100){inc=0;}
+        else{inc++;}
+        oled.clearDisplay();
+        oled.setTextCursor(0,0); 
+//        oled.printf("MAX32630FTHR oled\n");
+//        oled.printf("TEST CODE");
+        Information(inc);
+//        oled.printf("AIN0/1: %1.2f, %1.2f\n", (6.0f * ain0), (6.0f * ain1) );  // analog inputs 0,1
+//        oled.printf("AIN2/3: %1.2f, %1.2f\n", (1.2f * ain2), (1.2f * ain3) );  // analog inputs 2,3
+//        oled.printf("UART:%c  A:%d  B:%d  C:%d\n", c, aButton.read(), bButton.read(), cButton.read());  // UART and Buttons
+        oled.display();
 //
     }
 }