UART Command Parser Time Manager Data Store for SD Card for stm32l476 [it's not Licensed as BSD/GPLx]
Dependencies: mbed SDFileSystem
main.cpp@2:a694440145e9, 2019-04-23 (annotated)
- Committer:
- Inscape_ao
- Date:
- Tue Apr 23 08:47:11 2019 +0000
- Revision:
- 2:a694440145e9
- Parent:
- 1:71c9c97c9f3d
- Child:
- 4:bec3f80dc49c
add TimeManager
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 | 0:c347f602596d | 7 | #include "global.h" |
Inscape_ao | 0:c347f602596d | 8 | #include "string.h" |
Inscape_ao | 0:c347f602596d | 9 | |
Inscape_ao | 0:c347f602596d | 10 | /** --- Global Variables --- */ |
Inscape_ao | 0:c347f602596d | 11 | Serial pc(SERIAL_TX, SERIAL_RX); |
Inscape_ao | 0:c347f602596d | 12 | DigitalOut myled(LED1); |
Inscape_ao | 2:a694440145e9 | 13 | SDFileSystem sd(SPI_MOSI, SPI_MISO, SPI_SCK, D4, "sd"); |
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 | 0:c347f602596d | 26 | /* Receive Buffer Control */ |
Inscape_ao | 0:c347f602596d | 27 | pUR = new UartReceiver(&pc); |
Inscape_ao | 0:c347f602596d | 28 | /* Generate Command parser as DeviceID = 0, ParsingRule = rules */ |
Inscape_ao | 2:a694440145e9 | 29 | pCP = new CommandParser(pUR, 0, rules, getNumOfRules); |
Inscape_ao | 0:c347f602596d | 30 | pCP->run(); |
Inscape_ao | 0:c347f602596d | 31 | |
Inscape_ao | 0:c347f602596d | 32 | pc.printf("Hello World !\n"); |
Inscape_ao | 0:c347f602596d | 33 | while(1) { |
Inscape_ao | 0:c347f602596d | 34 | wait(1); |
Inscape_ao | 0:c347f602596d | 35 | } |
Inscape_ao | 0:c347f602596d | 36 | } |