UART Command Parser Time Manager Data Store for SD Card for stm32l476 [it's not Licensed as BSD/GPLx]

Dependencies:   mbed SDFileSystem

Revision:
2:a694440145e9
Parent:
1:71c9c97c9f3d
Child:
4:bec3f80dc49c
--- a/main.cpp	Sun Apr 21 02:50:19 2019 +0000
+++ b/main.cpp	Tue Apr 23 08:47:11 2019 +0000
@@ -1,5 +1,7 @@
 /** --- Includes --- */
 #include "mbed.h"
+#include "SDFileSystem.h"
+#include "TimeManager.h"
 #include "UartReceiver.h"
 #include "CommandParser.h"
 #include "global.h"
@@ -8,46 +10,27 @@
 /** --- Global Variables --- */
 Serial pc(SERIAL_TX, SERIAL_RX);
 DigitalOut myled(LED1);
-    
-/** --- Prototypes --- */
-/** --- Static functions --- */
-static int sampleHanlder(CommandParser *pC, char *arg)
-{
-    pc.printf("[sampleHanlder] ARG=%s[EOL]", arg);
-    pC->reply();
-    return 0;
-}
-
-CmdParseRule rules[] = {
-    {"CMD", sampleHanlder},
-    };
-
-static inline int getNumOfRules(void)
-{
-    return sizeof(rules)/sizeof(CmdParseRule);
-}
+SDFileSystem sd(SPI_MOSI, SPI_MISO, SPI_SCK, D4, "sd");
 
 /** --- main --- */
 int main()
 {
-    int i = 1;
-
     /** UART Initalizer */
     /* setup UART 115200, 8bit, Parity=None, stopbit:1bit  */
     /* https://os.mbed.com/users/okini3939/notebook/Serial_jp/ */
     pc.baud(115200);
     pc.format(8, Serial::None, 1);
     
+    /* new timer manager */
+    pTM = new TimeManager();
     /* Receive Buffer Control */
     pUR = new UartReceiver(&pc);
     /* Generate Command parser as DeviceID = 0, ParsingRule = rules */
-    pCP = new CommandParser(pUR, 0, rules, getNumOfRules());
+    pCP = new CommandParser(pUR, 0, rules, getNumOfRules);
     pCP->run();
     
     pc.printf("Hello World !\n");
     while(1) {
         wait(1);
-        pc.printf("This program runs since %d seconds.\n", i++);
-        myled = !myled;
     }
 }