2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
Diff: main.cpp
- Revision:
- 0:7e98bbfd102a
- Child:
- 1:7019a60fd585
diff -r 000000000000 -r 7e98bbfd102a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 01 23:27:11 2018 +0000 @@ -0,0 +1,71 @@ +/* mbed Microcontroller Library + * Copyright (c) 2018 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mbed.h" +#include <stdio.h> +#include <errno.h> +#include "stats_report.h" +#include "SDBlockDevice.h" +#include "FATFileSystem.h" +#include "SimpleShell.h" + +Serial pc(USBTX, USBRX); +//SDBlockDevice bd(p5, p6, p7, p8); // MOSI, MISO, CLK, CS +//FATFileSystem ffs("log", &bd); +LocalFileSystem lfs("etc"); + +SimpleShell sh; + +DigitalOut led1(LED1); + +Thread thread; + +// main() runs in its own thread in the OS +int main() +{ + printf("Bootup...\n"); + fflush(stdout); + thread.start(callback(&sh, &SimpleShell::run)); + +/* + FILE *fp; + char buf[128]; + printf("Initializing the block device... "); + fflush(stdout); + int err = bd.init(); + printf("%s\n", (err ? "Fail :(" : "OK")); + + printf("Opening sdtest.txt..."); + fp = fopen("/log/sdtest.txt", "r"); + if(fp) { + while (!feof(fp)) { + fgets(buf, 127, fp); + printf(buf); + } + fclose(fp); + } + + printf("Opening config.txt..."); + fp = fopen("/etc/config.txt", "r"); + if(fp) { + while (!feof(fp)) { + fgets(buf, 127, fp); + printf(buf); + } + fclose(fp); + } +*/ + + //SystemReport sys_state(500); + + while (true) { + // Blink LED and wait 0.5 seconds + led1 = !led1; + wait(0.5f); + + // Following the main thread wait, report on the current system status + //sys_state.report_state(); + } +}