ROM Comm / Mbed 2 deprecated espar_mini_control_CAN

Dependencies:   mbed mbed-STM32F103C8T6

Revision:
8:2b0d18ebbba9
Parent:
7:467e350d1a10
Child:
9:6126b83608be
--- a/main.cpp	Wed Jun 10 20:15:48 2020 +0000
+++ b/main.cpp	Wed Jun 10 22:31:30 2020 +0000
@@ -18,7 +18,7 @@
 #include "mbed.h"
 #include "ecu_simulator.h"
 #include "globals.h"
-
+#include "heatcontrol.h"
 
 // pinout for Maple Mini
 DigitalIn click(PA_1);   // Button inputs
@@ -46,6 +46,19 @@
 //unsigned char menu_state;
 //unsigned char canspeed;
 
+// external variables
+volatile unsigned char idletimer;
+char printbuff[256];
+
+void DebugWrite(const char* str) {
+    pc.printf(str);    
+}
+void resetTimer(struct sHeatVars *s) {
+    //TODO: This.
+}
+void resetTimerAsync(struct sHeatVars *s) {
+    //TODO: This.
+}
 int main() 
 {
     confSysClock();     //Configure system clock (72MHz HSE clock, 48MHz USB clock)
@@ -81,26 +94,33 @@
     
     timer.attach(&attime, 1);
     
+    
+    initHeaterState(&heaterState[0]);
+    initHeaterState(&heaterState[1]);
+
+    heaterState[0].bustype = HEATERTYPECAN;
+    heaterState[0].heaternum = 1;
+    
+    heaterState[1].bustype = HEATERTYPENONE;
+    
+
     while(1)  // Main CAN loop
     {
-        sim.request();
         
-        if(!click)
+        for (int i = 0; i < HEATERSTATECOUNT; i++)
         {
-            //update_param(DEC);
-            if ( ecu.active_fault == true )
+//            wiced_update_system_monitor(&main_thread_monitor, 10 * 1000);
+            doHeatTaskCAN(&heaterState[i]);
+//            wiced_update_system_monitor(&main_thread_monitor, 10 * 1000);
+            doHeatLogicTask(&heaterState[i]);
+            if (i < HEATERSTATECOUNT)
             {
-                ecu.active_fault = false;
-                led4 = 0;               
-            } else {
-                ecu.active_fault = true;
-                led4 = 1;
-            } 
-            wait(0.1);   //Delay for auto repeat           
+                wait_ms(50);
+            }
+            else
+            {
+                //wiced_rtos_delay_milliseconds(50);
+            }
         }
-        //wait(0.1);   //Delay cause can bus problems
-        //led1 = 1;
-        //wait(0.1);
-        //led1 = 0; 
     }
 }