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

Dependencies:   mbed SDFileSystem

Committer:
Inscape_ao
Date:
Sat May 11 04:03:33 2019 +0000
Revision:
7:9ab8809f9693
Parent:
6:81a3d517fd56
Child:
9:c81d0df866f5
add Repeatable Controllor; add Dummy Devicedriver; add Sensing Control Command; (All Host->Device Commands are already implemented)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Inscape_ao 0:c347f602596d 1 /** --- Includes --- */
Inscape_ao 0:c347f602596d 2 #include "mbed.h"
Inscape_ao 2:a694440145e9 3 #include "SDFileSystem.h"
Inscape_ao 2:a694440145e9 4 #include "TimeManager.h"
Inscape_ao 0:c347f602596d 5 #include "UartReceiver.h"
Inscape_ao 0:c347f602596d 6 #include "CommandParser.h"
Inscape_ao 5:a37e3a15444b 7 #include "SDDataStore.h"
Inscape_ao 0:c347f602596d 8 #include "global.h"
Inscape_ao 0:c347f602596d 9 #include "string.h"
Inscape_ao 7:9ab8809f9693 10 #include "DeviceRepeater.h"
Inscape_ao 7:9ab8809f9693 11 #include "DummyDevice.h"
Inscape_ao 0:c347f602596d 12
Inscape_ao 0:c347f602596d 13 /** --- Global Variables --- */
Inscape_ao 0:c347f602596d 14 Serial pc(SERIAL_TX, SERIAL_RX);
Inscape_ao 0:c347f602596d 15 DigitalOut myled(LED1);
Inscape_ao 1:71c9c97c9f3d 16
Inscape_ao 0:c347f602596d 17 /** --- main --- */
Inscape_ao 0:c347f602596d 18 int main()
Inscape_ao 0:c347f602596d 19 {
Inscape_ao 0:c347f602596d 20 /** UART Initalizer */
Inscape_ao 0:c347f602596d 21 /* setup UART 115200, 8bit, Parity=None, stopbit:1bit */
Inscape_ao 0:c347f602596d 22 /* https://os.mbed.com/users/okini3939/notebook/Serial_jp/ */
Inscape_ao 0:c347f602596d 23 pc.baud(115200);
Inscape_ao 0:c347f602596d 24 pc.format(8, Serial::None, 1);
Inscape_ao 0:c347f602596d 25
Inscape_ao 7:9ab8809f9693 26 /* create Device */
Inscape_ao 7:9ab8809f9693 27 pDevRept = new DeviceRepeater(&DummyDev);
Inscape_ao 6:81a3d517fd56 28
Inscape_ao 2:a694440145e9 29 /* new timer manager */
Inscape_ao 2:a694440145e9 30 pTM = new TimeManager();
Inscape_ao 5:a37e3a15444b 31 /* Generate SDDataStore */
Inscape_ao 5:a37e3a15444b 32 pSds = new SDDataStore(pTM);
Inscape_ao 0:c347f602596d 33 /* Receive Buffer Control */
Inscape_ao 0:c347f602596d 34 pUR = new UartReceiver(&pc);
Inscape_ao 0:c347f602596d 35 /* Generate Command parser as DeviceID = 0, ParsingRule = rules */
Inscape_ao 2:a694440145e9 36 pCP = new CommandParser(pUR, 0, rules, getNumOfRules);
Inscape_ao 0:c347f602596d 37 pCP->run();
Inscape_ao 6:81a3d517fd56 38
Inscape_ao 7:9ab8809f9693 39 pc.printf(":0 ACK 0004 0000\n");
Inscape_ao 4:bec3f80dc49c 40
Inscape_ao 0:c347f602596d 41 while(1) {
Inscape_ao 0:c347f602596d 42 wait(1);
Inscape_ao 0:c347f602596d 43 }
Inscape_ao 0:c347f602596d 44 }