The HexiHeart is a demo project product that takes advantage of many of the onboard Hexiwear sensors and capabilities to create a multifunctional fitness and safety watch.

Dependencies:   FXAS21002 FXOS8700 Hexi_KW40Z Hexi_OLED_SSD1351 MAXIM W25Q64FVSSIG HTU21D MPL3115A2 TSL2561

Fork of HexiHeart_Alex by Hexiwear_zeta

Files at this revision

API Documentation at this revision

Comitter:
nbaker
Date:
Sun Nov 12 22:14:37 2017 +0000
Child:
1:e4b38d6918ba
Commit message:
This is my first attempt at the menu structure and basic features.

Changed in this revision

.gitignore Show annotated file Show diff for this revision Revisions of this file
FXAS21002.lib Show annotated file Show diff for this revision Revisions of this file
FXOS8700.lib Show annotated file Show diff for this revision Revisions of this file
Hexi_KW40Z.lib Show annotated file Show diff for this revision Revisions of this file
Hexi_OLED_SSD1351.lib Show annotated file Show diff for this revision Revisions of this file
README.md Show annotated file Show diff for this revision Revisions of this file
img/uvision.png 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
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Sun Nov 12 22:14:37 2017 +0000
@@ -0,0 +1,4 @@
+.build
+.mbed
+projectfiles
+*.py*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXAS21002.lib	Sun Nov 12 22:14:37 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/AswinSivakumar/code/FXAS21002/#b774372b3913
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXOS8700.lib	Sun Nov 12 22:14:37 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/AswinSivakumar/code/FXOS8700/#98ea52282575
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hexi_KW40Z.lib	Sun Nov 12 22:14:37 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Hexiwear/code/Hexi_KW40Z/#f6f9b24aea57
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hexi_OLED_SSD1351.lib	Sun Nov 12 22:14:37 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Hexiwear/code/Hexi_OLED_SSD1351/#ae5fad429790
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Sun Nov 12 22:14:37 2017 +0000
@@ -0,0 +1,87 @@
+# Getting started with Blinky on mbed OS
+
+This guide reviews the steps required to get Blinky working on an mbed OS platform.
+
+Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
+
+## Import the example application
+
+From the command-line, import the example:
+
+```
+mbed import mbed-os-example-blinky
+cd mbed-os-example-blinky
+```
+
+### Now compile
+
+Invoke `mbed compile`, and specify the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
+
+```
+mbed compile -m K64F -t ARM
+```
+
+Your PC may take a few minutes to compile your code. At the end, you see the following result:
+
+```
+[snip]
++----------------------------+-------+-------+------+
+| Module                     | .text | .data | .bss |
++----------------------------+-------+-------+------+
+| Misc                       | 13939 |    24 | 1372 |
+| core/hal                   | 16993 |    96 |  296 |
+| core/rtos                  |  7384 |    92 | 4204 |
+| features/FEATURE_IPV4      |    80 |     0 |  176 |
+| frameworks/greentea-client |  1830 |    60 |   44 |
+| frameworks/utest           |  2392 |   512 |  292 |
+| Subtotals                  | 42618 |   784 | 6384 |
++----------------------------+-------+-------+------+
+Allocated Heap: unknown
+Allocated Stack: unknown
+Total Static RAM memory (data + bss): 7168 bytes
+Total RAM memory (data + bss + heap + stack): 7168 bytes
+Total Flash memory (text + data + misc): 43402 bytes
+Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin
+```
+
+### Program your board
+
+1. Connect your mbed device to the computer over USB.
+1. Copy the binary file to the mbed device.
+1. Press the reset button to start the program.
+
+The LED on your platform turns on and off.
+
+## Export the project to Keil MDK, and debug your application
+
+From the command-line, run the following command:
+
+```
+mbed export -m K64F -i uvision
+```
+
+To debug the application:
+
+1. Start uVision.
+1. Import the uVision project generated earlier.
+1. Compile your application, and generate an `.axf` file.
+1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger).
+1. Set breakpoints, and start a debug session.
+
+![Image of uVision](img/uvision.png)
+
+## Troubleshooting
+
+1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0`
+
+ ```
+ mbed --version
+ ```
+
+ If not, you can update it:
+
+ ```
+ pip install mbed-cli --upgrade
+ ```
+
+2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32 KB restriction on code size.
\ No newline at end of file
Binary file img/uvision.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Nov 12 22:14:37 2017 +0000
@@ -0,0 +1,764 @@
+/********************************************************************** 
+Texas State University Senior Project - HexiHeart 
+Team Zeta: Alex Song, Jasmine Rounsaville, Issam Hichami, Neil Baker
+Version: HexiHeart_1st 11/12/17
+This version has basic menu layout and screen timeout feature.  The menu
+are just placeholders (for the most part) and will be either adjusted or 
+replaced with graphic images.
+
+***********************************************************************/
+
+#include "mbed.h"
+#include "Hexi_KW40Z.h"         // Button and BLE fuctions
+#include "FXOS8700.h"           // 3D Accelorometer & Mag
+#include "FXAS21002.h"          // 3-Axis Gyroscope
+#include "Hexi_OLED_SSD1351.h"  // OLED fuctions
+#include "OLED_types.h"         // Text attributs
+#include "string.h"
+#include "OpenSans_Font.h"
+/* We need to confirm whether it's better to include and 
+configure every module for lowest power, or whether it's 
+better to save memory by not doing that
+*/
+
+// Definitions
+#define LED_ON      0
+#define LED_OFF     1
+#define SCRN_TIME   10.0
+#define Debug       1 // If "Debug" is defined, our code will compile for debug.  Comment out for Production code.
+   
+void StartHaptic(void);
+void StopHaptic(void const *n);
+void error_screen(void);
+void update_display(void);
+
+// *****************  Global variables  ***********************
+char text_1[20];            // Text buffer - Do we need more?
+bool OLED_ON = 1;           // Turn OLED power on/off
+bool Fall_Alert = 0;        // Initialize as no active alert
+bool Panic_Alert = 0;        // Initialize as no active alert
+bool Fall_Alert_Mode = 1;   //  Initialize with fall alert mode on 
+bool Heart_Rate_Mode = 0;   //  Initialize with Heart rate off 
+float Accel_Mag=0.0;        // Vector magnitude calculated from sensor data
+float Accel_Data[3];        // Accel Data from sensor
+float Gyro_Mag=0.0;        // Vector magnitude calculated from sensor data
+float Gyro_Data[3];        // Gyro data from sensor
+float Fall_Thresh=0.5;        // Initialize Fall detect Threshold
+float Impact_Thresh=3.0;        // Initialize Impact detect Threshold
+float Movement_Thresh=50.0;        // Initialize Movement detect Threshold
+uint8_t Age = 30;            // Initialize age
+uint8_t Max_BPM = 190;       // Initialize Max BPM
+uint8_t Screen_Num = 0;      // Initialize to main screen
+uint8_t Error_Num = 0;         // Error num for debug 
+// ***************** Define pins *****************************
+FXAS21002 gyro(PTC11,PTC10); // Gyroscope
+SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); // SSD1351 OLED Driver (MOSI,SCLK,POWER,CS,RST,DC)
+FXOS8700 accel(PTC11, PTC10); // Accelorometer
+FXOS8700 mag(PTC11, PTC10);   // Mag (same chip as Accel)
+
+DigitalOut RED_Led(LED1);
+DigitalOut GRN_Led(LED2);
+DigitalOut BLU_Led(LED3);
+DigitalOut haptic(PTB9);
+
+/* Instantiate the Hexi KW40Z Driver (UART TX, UART RX) */ 
+KW40Z kw40z_device(PTE24, PTE25);
+
+/* Define timer for haptic feedback */
+RtosTimer hapticTimer(StopHaptic, osTimerOnce);
+
+//***************** Tickers and Timers *****************
+Ticker Screen_Timer;// use ticker to turn off OLED
+
+void timout_timer(){// turn off display mode
+     oled.FillScreen(COLOR_BLACK); // Clear screen.. is there a better command for this?
+     OLED_ON = 0;  // set flag to off
+     Screen_Timer.detach();
+    }//end routine
+    
+void ButtonUp(void)
+{
+Screen_Timer.attach(&timout_timer,(SCRN_TIME));//Is this sufficient to reset/restart ticker timer for OLED?
+if (OLED_ON == 0){
+    OLED_ON = 1; // Scree was off, set to On
+    update_display();
+}
+else
+{
+switch(Screen_Num) {
+                case 0: {// We're in Main Screen
+                    // do nothing, wrong button
+                    break;
+                }
+                case 1: {// Panic Alert option
+                    StartHaptic();
+                    Screen_Num = 5;  //Change to screen 5
+#ifdef Debug    // in debug show debug/diagnostic screens                         
+                    Screen_Num = 20;  //Change to screen 20
+#endif
+
+                    update_display();
+                    break;
+                }
+                case 2: {// Fall Alert option
+                    StartHaptic();
+                    Screen_Num = 1;  //Change to screen 1
+                    update_display();
+                    break;
+                }
+                case 3: {// Heart Rate Monitoring option
+                    StartHaptic();
+                    Screen_Num = 2;  //Change to screen 2
+                    update_display();
+                    break;
+                }
+                case 4: {// Alert History option
+                    StartHaptic();
+                    Screen_Num = 3; //Change to screen 3
+                    update_display();
+                    break;
+                }
+                case 5: {// About HexiHeart
+                    StartHaptic();
+                    Screen_Num = 4; //Change to screen 4
+                    update_display();
+                    break;
+                }
+                case 6: {// Panic Alert
+                     StartHaptic();
+                    Panic_Alert = !Panic_Alert;
+                    update_display(); 
+                    break;
+                }
+                case 7: {// Heart Rate Zone
+                    StartHaptic();
+                    //Increment Age
+                    break;
+                }
+                case 8: {// Alert History
+                    StartHaptic();
+                    //Increment  alert index
+                    break;
+                }    
+                case 20: {// Diagnostic/Debug Screens
+                    StartHaptic();
+                    Screen_Num = 5;  //Change to screen 5
+                    update_display();
+                    break;
+                }
+                case 21: {// Fall Diagnostic
+                    StartHaptic();
+                    Screen_Num = 25;  //Change to screen 25
+                    update_display();
+                    break;
+                }
+                case 22: {// Fall Debug
+                    StartHaptic();
+                    Screen_Num = 21;  //Change to screen 21
+                    update_display();
+                    break;
+                }
+                case 23: {// Heart Rate Diagnostic
+                    StartHaptic();
+                    Screen_Num = 22;  //Change to screen 22
+                    update_display();
+                    break;
+                }
+                case 24: {// Heart Rate Debug
+                    StartHaptic();
+                    Screen_Num = 23;  //Change to screen 23
+                    update_display();
+                    break;
+                }
+                case 25: {// Heat Index Diagnostic
+                    StartHaptic();
+                    Screen_Num = 24;  //Change to screen 24
+                    update_display();
+                    break;
+                }
+                default: {
+                    break;
+                } 
+    }
+    }
+}
+
+void ButtonDown(void)
+{
+Screen_Timer.attach(&timout_timer,(SCRN_TIME));//Is this sufficient to reset/restart ticker timer for OLED?
+if (OLED_ON == 0){
+    OLED_ON = 1; // Scree was off, set to On
+    update_display();
+}
+else
+{
+
+switch(Screen_Num) {
+                case 0: {// We're in Main Screen
+                    // do nothing, wrong button
+                    break;
+                }
+                case 1: {// Panic Alert option
+                    StartHaptic();
+                    Screen_Num = 2;  //Change to screen 2
+                    update_display();
+                    break;
+                }
+                case 2: {// Fall Alert option
+                    StartHaptic();
+                    Screen_Num = 3;  //Change to screen 3
+                    update_display();
+                    break;
+                }
+                case 3: {// Heart Rate Monitoring option
+                    StartHaptic();
+                    Screen_Num = 4;  //Change to screen 4
+                    update_display();
+                    break;
+                }
+                case 4: {// Alert History option
+                    StartHaptic();
+                    Screen_Num = 5;  //Change to screen 5
+                    update_display();
+                    break;
+                }
+                case 5: {// About HexiHeart option
+                    StartHaptic();
+                    Screen_Num = 1;  //Change to screen 1
+#ifdef Debug    // in debug show debug/diagnostic screens                         
+                    Screen_Num = 20;  //Change to screen 20
+#endif
+                    update_display();
+                    break;
+                }
+                case 6: {// Panic Alert
+                   // do nothing, wrong button
+                    break;
+                }
+                case 7: {// Heart Rate Zone
+                    StartHaptic();
+                    //decriment Age
+                    break;
+                }
+                case 8: {// Alert History
+                    StartHaptic();
+                    //decriment alert index
+                    break;
+                }
+                case 20: {// Diagnostic/Debug Screens
+                    StartHaptic();
+                    Screen_Num = 1;  //Change to screen 1
+                    update_display();
+                    break;
+                } 
+                case 21: {// Fall Diagnostic
+                    StartHaptic();
+                    Screen_Num = 22;  //Change to screen 22
+                    update_display();
+                    break;
+                }
+                case 22: {// Fall Debug
+                    StartHaptic();
+                    Screen_Num = 23;  //Change to screen 25
+                    update_display();
+                    break;
+                }
+                case 23: {// Heart Rate Diagnostic
+                    StartHaptic();
+                    Screen_Num = 24;  //Change to screen 24
+                    update_display();
+                    break;
+                }
+                case 24: {// Heart Rate Ddebug
+                    StartHaptic();
+                    Screen_Num = 25;  //Change to screen 25
+                    update_display();
+                    break;
+                }
+                case 25: {// Heat Index Diagnostic
+                    StartHaptic();
+                    Screen_Num = 21;  //Change to screen 21
+                    update_display();
+                    break;
+                }
+                default: {
+                    break;
+                } 
+    }
+    }
+}
+
+void ButtonRight(void)
+{
+Screen_Timer.attach(&timout_timer,(SCRN_TIME));//Is this sufficient to reset/restart ticker timer for OLED?
+if (OLED_ON == 0){
+    OLED_ON = 1; // Scree was off, set to On
+    update_display();
+}
+else
+{
+   switch(Screen_Num) {
+                case 0: {// We're in Main Screen
+                    StartHaptic();
+                    Screen_Num = 1;  //Change to screen 1
+                    update_display();
+                    break;
+                }
+                case 1: {// Panic Alert option
+                    StartHaptic();
+                    Screen_Num = 6;  //Change to screen 6
+                    update_display();
+                    break;
+                }
+                case 2: {// Fall Alert option
+                    StartHaptic();
+                    // toggle on/off
+                    break;
+                }
+                case 3: {// Heart Rate Monitoring option
+                    StartHaptic();
+                    Screen_Num = 7;  //Change to screen 7
+                    update_display();
+                    break;
+                }
+                case 4: {// Alert History option
+                    StartHaptic();
+                    Screen_Num = 8;  //Change to screen 8
+                    update_display();
+                    break;
+                }
+                case 5: {// About HexiHeart option
+                    StartHaptic();
+                    Screen_Num = 9;  //Change to screen 9
+                    update_display();
+                    break;
+                }
+
+                case 6: {// Panic Alert
+                    // do nothing, wrong button
+                    break;
+                }
+                case 7: {// Heart Rate Zone
+                    StartHaptic();
+                    // toggle on/off
+                    break;
+                }
+                case 20: {// Diagnostic/Debug Screens
+                    StartHaptic();
+                     Screen_Num = 21;  //Change to screen 21
+                     update_display();
+                    break;
+                }
+                default: {
+                    break;
+                } 
+    }
+    }
+}
+
+void ButtonLeft(void)
+{
+ Screen_Timer.attach(&timout_timer,(SCRN_TIME));//Is this sufficient to reset/restart ticker timer for OLED? 
+ if (OLED_ON == 0){
+    OLED_ON = 1; // Scree was off, set to On
+    update_display();
+}
+else
+{
+  switch(Screen_Num) {
+                case 0: {// We're in Main Screen
+                    // do nothing, wrong button
+                    break;
+                }
+                case 1: {// Panic Alert option
+                    StartHaptic();
+                    Screen_Num = 0;  //Change to screen 0
+                    update_display();
+                    break;
+                }
+                case 2: {// Fall Alert option
+                    StartHaptic();
+                    Screen_Num = 0;  //Change to screen 0
+                    update_display();
+                    break;
+                }
+                case 3: {// Heart Rate Monitoring option
+                    StartHaptic();
+                    Screen_Num = 0;  //Change to screen 0
+                    update_display();
+                    break;
+                }
+                case 4: {// Alert History option
+                    StartHaptic();
+                    Screen_Num = 0;  //Change to screen 0
+                    update_display();
+                    break;
+                }
+                case 5: {// About HexiHeart option
+                    StartHaptic();
+                    Screen_Num = 0;  //Change to screen 0
+                    update_display();
+                    break;
+                }
+                case 6: {// Panic Alert
+                    StartHaptic();
+                    Screen_Num = 1;  //Change to screen 1
+                    update_display();
+                    break;
+                }
+                case 7: {// Heart Rate Zone
+                    StartHaptic();
+                    Screen_Num = 3;  //Change to screen 3
+                    update_display();
+                    break;
+                }
+                case 8: {// Alert History
+                    StartHaptic();
+                    Screen_Num = 4;  //Change to screen 4
+                    update_display();
+                    break;
+                }
+                case 20: {// Diagnostic/Debug Screens
+                    StartHaptic();
+                    Screen_Num = 0;  //Change to screen 0
+                    update_display();
+                    break;
+                }
+                case 21: {// Fall Diagnostic
+                    StartHaptic();
+                    Screen_Num = 20;  //Change to screen 20
+                    update_display();
+                    break;
+                }
+                case 22: {// Fall Debug
+                    StartHaptic();
+                    Screen_Num = 20;  //Change to screen 20
+                    update_display();
+                    break;
+                }
+                case 23: {// Heart Rate Diagnostic
+                    StartHaptic();
+                    Screen_Num = 20;  //Change to screen 20
+                    update_display();
+                    break;
+                }
+                case 24: {// Heart Rate Debug
+                    StartHaptic();
+                    Screen_Num = 20;  //Change to screen 20
+                    update_display();
+                    break;
+                }
+                case 25: {// Heat Index Diagnostic
+                    StartHaptic();
+                    Screen_Num = 20;  //Change to screen 20
+                    update_display();
+                    break;
+                }
+                default: {
+                    break;
+                } 
+    }
+    }
+}
+
+
+void ButtonSlide(void)  // What is this Slide button???
+{
+ Screen_Timer.attach(&timout_timer,(SCRN_TIME));//Is this sufficient to reset/restart ticker timer for OLED? 
+ if (OLED_ON == 0){
+    OLED_ON = 1; // Scree was off, set to On
+}
+    StartHaptic();
+    oled.FillScreen(COLOR_BLACK); // Clear screen
+    strcpy((char *) text_1,"Slide Button");
+    oled.Label((uint8_t *)text_1,0,40);
+}
+   
+int main()
+{
+    oled.FillScreen(COLOR_BLACK); // Clear screen
+ // *****************  Local variables  ***********************
+ //   float accel_data[3]; float accel_rms=0.0;
+    
+// **************  configure sensor modules  ******************
+    accel.accel_config();
+    mag.mag_config();
+//    gyro.gyro_config();
+    
+    RED_Led = LED_OFF;
+    GRN_Led = LED_OFF;
+    BLU_Led = LED_OFF;
+// ***** Register callbacks/interupts to application functions *********
+    kw40z_device.attach_buttonUp(&ButtonUp);
+    kw40z_device.attach_buttonDown(&ButtonDown);
+    kw40z_device.attach_buttonLeft(&ButtonLeft);
+    kw40z_device.attach_buttonRight(&ButtonRight);
+    kw40z_device.attach_buttonSlide(&ButtonSlide);
+
+// **** Get OLED Class Default Text Properties ****************
+      oled_text_properties_t textProperties = {0};
+      oled.GetTextProperties(&textProperties); 
+      
+// *********Set text color and screen alignment  **************
+      textProperties.fontColor = COLOR_WHITE;
+      textProperties.alignParam = OLED_TEXT_ALIGN_LEFT;
+      oled.SetTextProperties(&textProperties);   
+  
+// **************  Display spash screen  **********************
+
+    oled.Label((uint8_t *)"Hexi",20,5); // Display white "Hexi" at x,y
+    textProperties.fontColor = COLOR_RED;
+    oled.SetTextProperties(&textProperties);  
+    oled.Label((uint8_t *)"Heart",45,5); // Display red "Heart" at x,y  
+
+    #ifdef Debug  // if this is non-production version - do this
+    strcpy((char *) text_1,"This is Debug Ver");
+    oled.Label((uint8_t *)text_1,0,60);  // text_1 at x,y
+    StartHaptic();
+    #endif
+    textProperties.fontColor = COLOR_WHITE;
+    oled.SetTextProperties(&textProperties);
+    wait(3);  // wait 3 seconds
+    update_display(); // Displays current screen (screen 0) 
+    Screen_Timer.attach(&timout_timer,(SCRN_TIME));//start ticker timer for turning off LCD
+//  ******************* Main Loop *************************      
+    while (true) {
+
+    Thread::wait(500); // wait half a sec in each loop
+    }
+}
+//  ************** end of main()
+
+void update_display(void)
+{
+oled_text_properties_t textProperties = {0};  // Need these to change font color
+oled.GetTextProperties(&textProperties);      // Need these to change font color
+   switch(Screen_Num) {
+                case 0: {// Main Screen
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    oled.Label((uint8_t *)"Batt",60,0); // Display "Batt" at x,y
+                    oled.Label((uint8_t *)"Date",35,20); // Display "Date" at x,y
+                    oled.Label((uint8_t *)"Time",35,40); // Display "Time" at x,y
+                    oled.Label((uint8_t *)"H.I.",10,80); // Display "H.I." at x,y
+                    oled.Label((uint8_t *)"BT",40,80);  //Display "BT" at x,y                 
+                    oled.Label((uint8_t *)"Menu",60,80);  //Display "Menu" at x,y
+                    if(Heart_Rate_Mode == 1){
+                    oled.Label((uint8_t *)"BPM",35,60); // Display "H.I." at x,y    
+                    }
+                    break;
+                }
+                case 1: {// Panic Alert option
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    oled.Label((uint8_t *)"Panic Alert",20,5); // Display at x,y
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)"Back",10,80); // Display "Back" at x,y
+                    oled.Label((uint8_t *)"Enter",60,80);  //Display "enter" at x,y 
+                    break;
+                }
+                case 2: {// Fall Alert option
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    oled.Label((uint8_t *)"Fall Alert",20,5); // Display at x,y
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)"Back",10,80); // Display "Back" at x,y
+                    oled.Label((uint8_t *)"Toggle",60,80);  //Display "Toggle" at x,y 
+                    break;
+                }
+                case 3: {// Heart Rate Monitoring option
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    oled.Label((uint8_t *)"Heart Rate",20,5); // Display at x,y
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)"Back",10,80); // Display "Back" at x,y
+                    oled.Label((uint8_t *)"Enter",60,80);  //Display at x,y 
+                    break;
+                }
+                case 4: {// Alert History option
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    oled.Label((uint8_t *)"Alert History",5,5); // Display at x,y
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)"Back",10,80); // Display "Back" at x,y
+                    oled.Label((uint8_t *)"Enter",60,80);  //Display at x,y 
+                    break;
+                }
+                case 5: {// About HexiHeart Screen
+
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    oled.Label((uint8_t *)"Hexi",20,20); // Display white "Hexi" at x,y
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);  
+                    oled.Label((uint8_t *)"Heart",45,20); // Display red "Heart" at x,y  
+                    textProperties.fontColor = COLOR_WHITE;
+                    oled.SetTextProperties(&textProperties);
+                    strcpy((char *) text_1,"About");
+                    oled.Label((uint8_t *)text_1,30,5);  // text_1 at x,y
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)" Back ",9,80); // Display "Back" at x,y
+                    oled.Label((uint8_t *)" Enter ",59,80);  //Display at x,y   
+                    break;
+                }
+
+                case 6: {// Panic Alert
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    if (Panic_Alert == 0){
+                    oled.Label((uint8_t *)"Send ",20,10); // Display at x,y
+                    }
+                    else {
+                    oled.Label((uint8_t *)"Dismiss ",17,10); // Display at x,y
+                        }
+                    oled.Label((uint8_t *)"Panic Alert",15,40); // Display at x,y
+                    oled.Label((uint8_t *)"-->",80,15); // "*" at x,y
+                    oled.Label((uint8_t *)"Back",10,80); // Display "Back" at x,y 
+                    break;
+                }
+               case 7: {// Heart Rate Zone
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    oled.Label((uint8_t *)"Heart Rate",15,5); // Display at x,y
+                    oled.Label((uint8_t *)"Zone",25,15); // Display at x,y
+                    oled.Label((uint8_t *)"Age: ",20,40); // Display at x,y
+                    textProperties.fontColor = COLOR_GREEN;
+                    oled.SetTextProperties(&textProperties); 
+                    oled.Label((uint8_t *)Age,30,40); // Display at x,y                    
+                    textProperties.fontColor = COLOR_WHITE;
+                    oled.SetTextProperties(&textProperties); 
+                    oled.Label((uint8_t *)"+",85,15); // "+" at x,y
+                    oled.Label((uint8_t *)"-",85,60); // "-" at x,y
+                    oled.Label((uint8_t *)"Back",10,80); // Display "Back" at x,y 
+                    break;
+                }
+               case 8: {// Alert History
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    oled.Label((uint8_t *)"Alert History",5,5); // Display at x,y
+                    oled.Label((uint8_t *)"Date - Time",20,40); // Display at x,y
+                    oled.Label((uint8_t *)"Alert Type:",20,60); // Display at x,y 
+                    oled.Label((uint8_t *)"+",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"-",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)"Back",10,80); // Display "Back" at x,y 
+                    break;
+                }
+#ifdef Debug  // if this is non-production/debug version - do this
+                case 20: {// Diagnostic/Debug Screens
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);
+                    oled.Label((uint8_t *)"Diagnostics",10,5); // Display at x,y
+                    oled.Label((uint8_t *)" Enter ",59,80);  //Display at x,y
+                    textProperties.fontColor = COLOR_WHITE;
+                    oled.SetTextProperties(&textProperties);  
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)" Back ",9,80); // Display "Back" at x,y
+
+                    break;
+                }
+                case 21: {// Fall Alert Diagnostic Screen            
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);
+                    oled.Label((uint8_t *)"Fall",30,5); // Display at x,y
+                    oled.Label((uint8_t *)"Diagnostic",25,5); // Display at x,y
+                    textProperties.fontColor = COLOR_WHITE;
+                    oled.SetTextProperties(&textProperties);  
+                    accel.acquire_accel_data_g(Accel_Data);
+ //                   gyro.acquire_gyro_data_g(Gyro_Data);
+                    Accel_Mag = sqrt(((Accel_Data[0]*Accel_Data[0])+(Accel_Data[1]*Accel_Data[1])+(Accel_Data[2]*Accel_Data[2])));
+  //                  Gyro_Mag = (abs(Gyro_Data[0])+abs(Gyro_Data[1])+abs(Gyro_Data[3]));
+                    sprintf(text_1," Accel:%2.2f g  ",Accel_Mag);
+                    oled.Label((uint8_t *)text_1,10,40);// text_1 at x,y
+                    sprintf(text_1," Gyro:%4.0f D/S  ",Gyro_Mag);
+                    oled.Label((uint8_t *)text_1,10,60);// text_1 at x,y
+                    oled.Label((uint8_t *)"Back",10,80); // Display "Back" at x,y
+                    break;    
+                }
+                case 22: {// Fall Alert Debug Screen
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);
+                    oled.Label((uint8_t *)"Fall Debug",15,5); // Display at x,y
+                    textProperties.fontColor = COLOR_GREEN;
+                    oled.SetTextProperties(&textProperties); 
+                    sprintf(text_1," %1.1f g  ",Fall_Thresh);
+                    oled.Label((uint8_t *)text_1,35,20);// text_1 at x,y
+                    sprintf(text_1," %2.1f g  ",Impact_Thresh);
+                    oled.Label((uint8_t *)text_1,35,35);// text_1 at x,y 
+                    sprintf(text_1," %3.0f D/S  ",Movement_Thresh);
+                    oled.Label((uint8_t *)text_1,35,50);// text_1 at x,y 
+                    textProperties.fontColor = COLOR_WHITE;
+                    oled.SetTextProperties(&textProperties); 
+                    oled.Label((uint8_t *)"F-Th:",5,20); // "*" at x,y 
+                    oled.Label((uint8_t *)"I-Th:",5,35); // "*" at x,y 
+                    oled.Label((uint8_t *)"M-Th:",5,50); // "*" at x,y                   
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)" Back ",9,80); // Display "Back" at x,y
+  //                  oled.Label((uint8_t *)" Enter ",59,80);  //Display at x,y   
+                    break;
+                }                                            
+                case 23: {// Heart Rate Diagnostic Screen
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);
+                    oled.Label((uint8_t *)"H.R. Diagnostic",5,5); // Display at x,y
+                    textProperties.fontColor = COLOR_WHITE;
+                    oled.SetTextProperties(&textProperties);                    
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)" Back ",9,80); // Display "Back" at x,y
+     //               oled.Label((uint8_t *)" Enter ",59,80);  //Display at x,y   
+                    break;
+                }
+                case 24: {// Heart Rate Debug Screen
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);
+                    oled.Label((uint8_t *)"H.R. Debug",10,5); // Display at x,y
+                    textProperties.fontColor = COLOR_WHITE;
+                    oled.SetTextProperties(&textProperties);                    
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)" Back ",9,80); // Display "Back" at x,y
+     //               oled.Label((uint8_t *)" Enter ",59,80);  //Display at x,y   
+                    break;
+                }
+                    case 25: {// Heat Index Diagnostic Screen
+                    oled.FillScreen(COLOR_BLACK); // Clear screen
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);
+                    oled.Label((uint8_t *)"H.I. Diagnostic",5,5); // Display at x,y
+                    textProperties.fontColor = COLOR_WHITE;
+                    oled.SetTextProperties(&textProperties);                    
+                    oled.Label((uint8_t *)"*",85,15); // "*" at x,y
+                    oled.Label((uint8_t *)"*",85,60); // "*" at x,y
+                    oled.Label((uint8_t *)" Back ",9,80); // Display "Back" at x,y
+     //               oled.Label((uint8_t *)" Enter ",59,80);  //Display at x,y   
+                    break;
+                }
+#endif  // end of non-production/debug version code
+                default: {
+                    Error_Num=1;
+                    error_screen(); // Clear screen
+                    break;
+                } 
+    }
+}
+void error_screen(void){
+        oled.FillScreen(COLOR_RED); // Clear screen
+        oled.Label((uint8_t *)"Error! ",30,30); // Display error at x,y 
+        sprintf(text_1," %i  ",Error_Num);
+        oled.Label((uint8_t *)text_1,30,60); // Display error at x,y 
+        wait(3);  // wait 3 seconds
+        oled.FillScreen(COLOR_BLACK); // Clear screen
+}
+void StartHaptic(void)
+{
+    hapticTimer.start(30);  // was originaly 50
+    haptic = 1;
+}
+
+void StopHaptic(void const *n) {
+    haptic = 0;
+    hapticTimer.stop();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Sun Nov 12 22:14:37 2017 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#e62a1b9236b44e70ae3b0902dc538481c04d455b