Code supports writing to the SD card as well as working with the Volckens group smartphone apps for the mbed HRM1017

Dependencies:   ADS1115 BLE_API BME280 Calibration CronoDot EEPROM LSM303 MCP40D17 NCP5623BMUTBG SDFileSystem SI1145 STC3100 mbed nRF51822

Fork of UPAS_BLE_and_USB by Volckens Group Sensors

Files at this revision

API Documentation at this revision

Comitter:
joshuasmth04
Date:
Thu Aug 20 16:28:37 2015 +0000
Parent:
71:78edbceff4fc
Child:
73:47910ee23ebf
Commit message:
Updated to uses the universal serial menu.

Changed in this revision

Honduras_SerialMenu_ble.lib Show diff for this revision Revisions of this file
UPAS-Honduras_with_BLE.lib Show annotated file Show diff for this revision Revisions of this file
Universal_Serial_Menu.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/Honduras_SerialMenu_ble.lib	Wed Aug 19 18:05:51 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/Vockens-Group-Sensors/code/Honduras_SerialMenu_ble/#d74a5e09cb8d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UPAS-Honduras_with_BLE.lib	Thu Aug 20 16:28:37 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Vockens-Group-Sensors/code/UPAS-Honduras_with_BLE/#78edbceff4fc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Universal_Serial_Menu.lib	Thu Aug 20 16:28:37 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Vockens-Group-Sensors/code/Universal_Serial_Menu/#700d8dff0ac5
--- a/main.cpp	Wed Aug 19 18:05:51 2015 +0000
+++ b/main.cpp	Thu Aug 20 16:28:37 2015 +0000
@@ -9,7 +9,7 @@
 #include "NCP5623BMUTBG.h"
 #include "CronoDot.h"
 #include "EEPROM.h"
-#include "Honduras_SerialMenu.h"
+#include "US_Menu.h"
 #include "BLEDevice.h" 
 #include "BLE_Menu.h"
 
@@ -38,20 +38,20 @@
 BLEDevice   ble;
 BLE_Menu    bleMenu(ble, txPayload, rxPayload, uart_base_uuid_rev, uart_base_uuid, uartService);
 
-I2C i2c(p22, p20);
-Adafruit_ADS1115 ads(&i2c);
-MCP40D17 DigPot(&i2c);
-BME280 bmesensor(p22, p20);
-STC3100 gasG(p22, p20);
-Serial  pc(USBTX, USBRX);
-DigitalOut blower(p29, 0);
-DigitalOut pbKill(p18, 1);
-LSM303 movementsensor(p22, p20);
-SI1145 lightsensor(p22, p20);
-NCP5623BMUTBG RGB_LED(p22, p20);
-CronoDot RTC(p22, p20);
-EEPROM          E2PROM(p22, p20);
-Honduras_SerialMenu     Menu;
+I2C                 i2c(p22, p20);
+Adafruit_ADS1115    ads(&i2c);
+MCP40D17            DigPot(&i2c);
+BME280              bmesensor(p22, p20);
+STC3100             gasG(p22, p20);
+Serial              pc(USBTX, USBRX);
+DigitalOut          blower(p29, 0);
+DigitalOut          pbKill(p18, 1);
+LSM303              movementsensor(p22, p20);
+SI1145              lightsensor(p22, p20);
+NCP5623BMUTBG       RGB_LED(p22, p20);
+CronoDot            RTC(p22, p20);
+EEPROM              E2PROM(p22, p20);
+US_Menu             Menu;
 //DigitalOut      GPS_EN(p4,0);                     //pin 4 is used to enable and disable the GPS, in order to recive serial communications
 
 Timeout         stop;   //This is the stop call back object
@@ -127,6 +127,11 @@
 int dutyDown;
 uint8_t f_sec, f_min, f_hour, f_date, f_month, f_year;
 
+// variables are only place holders for the US_Menu //
+int refreshtime;
+float home_lat, home_lon, work_lat, work_lon;
+//*************************************************// 
+
 //int refresh_Time = 10;   // refresh time in s, note calling read_GPS()(or similar) will still take how ever long it needs(hopefully < 1s)
 
 char device_name[] = "---------------";
@@ -268,14 +273,14 @@
     ble.onDataWritten(WrittenHandler);          //what happens when the phone sends a message
     //**************//BLE initialization//**************//
     
-    Menu.read_menu(E2PROM, RunReady, volflowSet, device_name, dutyUp, dutyDown);       //Read all data from the EEPROM here
+    Menu.read_menu(E2PROM, logInerval,refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, RunReady);   //Read all data from the EEPROM here
     
     //Test for errors
     if(RTC.OSF()) {                 //Don't proceed if the RTC needs reset
         RGB_LED.set_led(0,1,1); // error code/color
         pc.printf("DATE/TIMESTAMP NEEDS TO BE RECALIBRATED!!\r\n");
-        Menu.Start(pc, E2PROM, RTC, RunReady, volflowSet, device_name, dutyUp, dutyDown);  //Forces you to open the menu
-        Menu.save_menu(E2PROM, RunReady, volflowSet, device_name, dutyUp, dutyDown);       //Save all data to the EEPROM
+        Menu.Start(pc, E2PROM, RTC, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, 513, 0.25);  //Forces you to open the menu
+        Menu.save_menu(E2PROM, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, RunReady);       //Save all data to the EEPROM
     }
     //RunReady = 0; //debug always open the menu
     if(RunReady == 0){
@@ -283,17 +288,17 @@
         pc.printf("Change Name\r\n");
         while(RunReady == 0){
             RGB_LED.set_led(0,1,1);   // error code/color
-            Menu.Start(pc, E2PROM, RTC, RunReady, volflowSet, device_name, dutyUp, dutyDown);  //Forces you to open the menu
+            RunReady = Menu.Start(pc, E2PROM, RTC, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, 513, 0.25);  //Forces you to open the menu
             RGB_LED.set_led(0,10,10); // error code/color
             bleMenu.open_menu(txPayload, rxCharacteristic, device_name, RTC, RunReady);
         }
         //RunReady = 1;
-        Menu.save_menu(E2PROM, RunReady, volflowSet, device_name, dutyUp, dutyDown);       //Save all data to the EEPROM
+        Menu.save_menu(E2PROM, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, RunReady);       //Save all data to the EEPROM
         pbKill = 0;
     }
     
     RunReady = 0;
-    Menu.save_menu(E2PROM, RunReady, volflowSet, device_name, dutyUp, dutyDown);       //Save all data to the EEPROM      
+    Menu.save_menu(E2PROM, logInerval, refreshtime, volflowSet, device_name, dutyUp, dutyDown, home_lat, home_lon, work_lat, work_lon, RunReady);       //Save all data to the EEPROM      
 
     stop.attach(&check_stop, 60);    // check if we should shut down every 5 seconds, starting 60s after the start.