UART Command Parser Time Manager Data Store for SD Card for stm32l476 [it's not Licensed as BSD/GPLx]
Dependencies: mbed SDFileSystem
main.cpp@5:a37e3a15444b, 2019-04-24 (annotated)
- Committer:
- Inscape_ao
- Date:
- Wed Apr 24 02:34:51 2019 +0000
- Revision:
- 5:a37e3a15444b
- Parent:
- 4:bec3f80dc49c
- Child:
- 6:81a3d517fd56
add SDDataStore ; and SD Control commands (SDS, SDE, SDW[for Test])
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:c347f602596d | 10 | |
Inscape_ao | 0:c347f602596d | 11 | /** --- Global Variables --- */ |
Inscape_ao | 0:c347f602596d | 12 | Serial pc(SERIAL_TX, SERIAL_RX); |
Inscape_ao | 0:c347f602596d | 13 | DigitalOut myled(LED1); |
Inscape_ao | 1:71c9c97c9f3d | 14 | |
Inscape_ao | 0:c347f602596d | 15 | /** --- main --- */ |
Inscape_ao | 0:c347f602596d | 16 | int main() |
Inscape_ao | 0:c347f602596d | 17 | { |
Inscape_ao | 0:c347f602596d | 18 | /** UART Initalizer */ |
Inscape_ao | 0:c347f602596d | 19 | /* setup UART 115200, 8bit, Parity=None, stopbit:1bit */ |
Inscape_ao | 0:c347f602596d | 20 | /* https://os.mbed.com/users/okini3939/notebook/Serial_jp/ */ |
Inscape_ao | 0:c347f602596d | 21 | pc.baud(115200); |
Inscape_ao | 0:c347f602596d | 22 | pc.format(8, Serial::None, 1); |
Inscape_ao | 0:c347f602596d | 23 | |
Inscape_ao | 2:a694440145e9 | 24 | /* new timer manager */ |
Inscape_ao | 2:a694440145e9 | 25 | pTM = new TimeManager(); |
Inscape_ao | 5:a37e3a15444b | 26 | /* Generate SDDataStore */ |
Inscape_ao | 5:a37e3a15444b | 27 | pSds = new SDDataStore(pTM); |
Inscape_ao | 0:c347f602596d | 28 | /* Receive Buffer Control */ |
Inscape_ao | 0:c347f602596d | 29 | pUR = new UartReceiver(&pc); |
Inscape_ao | 0:c347f602596d | 30 | /* Generate Command parser as DeviceID = 0, ParsingRule = rules */ |
Inscape_ao | 2:a694440145e9 | 31 | pCP = new CommandParser(pUR, 0, rules, getNumOfRules); |
Inscape_ao | 0:c347f602596d | 32 | pCP->run(); |
Inscape_ao | 0:c347f602596d | 33 | |
Inscape_ao | 0:c347f602596d | 34 | pc.printf("Hello World !\n"); |
Inscape_ao | 5:a37e3a15444b | 35 | //sdcard_main(); |
Inscape_ao | 4:bec3f80dc49c | 36 | |
Inscape_ao | 0:c347f602596d | 37 | while(1) { |
Inscape_ao | 0:c347f602596d | 38 | wait(1); |
Inscape_ao | 0:c347f602596d | 39 | } |
Inscape_ao | 0:c347f602596d | 40 | } |