embedded software for tortuga bike

Dependencies:   BLE_API BikeControl DataLogging X_NUCLEO_IDB0XA1 _24LCXXX mbed

Files at this revision

API Documentation at this revision

Comitter:
ptuytsch
Date:
Mon Jul 18 13:20:25 2016 +0000
Parent:
1:ffdec767aa55
Commit message:
code merged in separate library, not the most beautiful way

Changed in this revision

BikeControl.lib Show annotated file Show diff for this revision Revisions of this file
DataLogging.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
diff -r ffdec767aa55 -r 7eb0bb74a8b6 BikeControl.lib
--- a/BikeControl.lib	Mon Jul 18 09:33:08 2016 +0000
+++ b/BikeControl.lib	Mon Jul 18 13:20:25 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/The-Opportunity-Factory/code/BikeControl/#792a8f167ac0
+https://developer.mbed.org/teams/The-Opportunity-Factory/code/BikeControl/#39f462024f10
diff -r ffdec767aa55 -r 7eb0bb74a8b6 DataLogging.lib
--- a/DataLogging.lib	Mon Jul 18 09:33:08 2016 +0000
+++ b/DataLogging.lib	Mon Jul 18 13:20:25 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/The-Opportunity-Factory/code/DataLogging/#fad416fb6979
+https://developer.mbed.org/teams/The-Opportunity-Factory/code/DataLogging/#9079496c6e25
diff -r ffdec767aa55 -r 7eb0bb74a8b6 main.cpp
--- a/main.cpp	Mon Jul 18 09:33:08 2016 +0000
+++ b/main.cpp	Mon Jul 18 13:20:25 2016 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "BikeData.h"
 #include "BatteryState.h"
+#include "BikeControl.h"
 #include "ble/BLE.h"
 #include "ble/services/BikeService.h"
 #include "ble/services/BikeBatteryService.h"
@@ -13,14 +14,16 @@
                                 VARIABLES
 ****************************************************************************/
 
-
+/*
 //LIGHT
 DigitalOut lightFront(PB_14);
 DigitalOut lightBack(PA_11);
 DigitalOut lightLeft(PC_6);
-DigitalOut lightRight(PC_8);
+DigitalOut lightRight(PC_8);*/
 
 
+static BikeControl *bc;
+
 
 //3 battery states
 static BatteryState *trailerBattery;
@@ -28,7 +31,7 @@
 static BatteryState *auxiliaryBattery;
 
 //BLE VARIABLES
-static char     DEVICE_NAME[] = "TORTUGA";  //Define default name of the BLE device
+static char     DEVICE_NAME[] = "NAME";  //Define default name of the BLE device
 static const uint16_t uuid16_list[] = {BikeService::BIKE_SERVICE_UUID, 
                                         //GattService::UUID_DEVICE_INFORMATION_SERVICE,
                                         BatteryService::BATTERY_SERVICE_UUID,
@@ -47,7 +50,7 @@
 /***************************************************************************
                                 CONTROL FUNCTIONS
 ****************************************************************************/
-void runTestLight()
+/*void runTestLight()
 {
     printf("front\n");
     lightFront =1;
@@ -66,7 +69,7 @@
     wait(1);
     lightRight = 0;
     wait(1);
-}
+}*/
 
 /***************************************************************************
                                 BLE FUNCTIONS
@@ -151,9 +154,12 @@
     bikeBattery = new BatteryState(bikeBatteryPin,BatteryState::Battery48V);
     auxiliaryBattery = new BatteryState(auxiliaryBatteryPin,BatteryState::Battery48V);
     
+    bc = new BikeControl(bd,trailerBattery, bikeBattery, auxiliaryBattery);
+    
     
     printf("run TestLight \n");
-    runTestLight();
+    //runTestLight();
+    bc->runTestLight();
     
     uint8_t size = bd->getBikeNameSize();
     printf("name length: %i\n", size);
@@ -181,6 +187,8 @@
     printf("START \n");
     
     
+    bc->startControlLoop();
+    
     while(true)
      {
          if (update){
@@ -203,7 +211,7 @@
             update = false;
         }
         ble.waitForEvent(); //wait for an event when idle.
-            
-            
+        
+        bc->checkStatus();            
     }
 }