![](/media/cache/profiles/2012_sf_avc_095.jpg.50x50_q85.jpg)
2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
Diff: main.cpp
- Revision:
- 9:fc3575d2cbbf
- Parent:
- 7:1f2661b840ed
- Child:
- 10:9fb3feb38746
--- a/main.cpp Wed Dec 05 18:02:32 2018 +0000 +++ b/main.cpp Fri Dec 07 15:58:41 2018 +0000 @@ -11,6 +11,7 @@ #include "FATFileSystem.h" #include "SimpleShell.h" #include "Config.h" +#include "L3G4200D.h" Serial pc(USBTX, USBRX); //SDBlockDevice bd(p5, p6, p7, p8); // MOSI, MISO, CLK, CS @@ -19,14 +20,38 @@ Config config; SimpleShell sh; +L3G4200D gyro(p9, p10); DigitalOut led1(LED1); Thread thread; +/******** SHELL COMMANDS ********/ + void test() { printf("Hello world!\n"); } +void read_gyro() +{ + int g[3]; + gyro.read(g); + printf("Gyro: %d, %d, %d\n", g[0], g[1], g[2]); +} + + +/******** GYRO UPDATER ********/ +void gyro_update() +{ + int g[3]; + + while (1) { + gyro.read(g); + // send message / add to status fifo? + } +} + + +/******** MAIN ********/ // main() runs in its own thread in the OS int main() @@ -64,6 +89,7 @@ } sh.attach(test, "test"); + sh.attach(read_gyro, "gyro"); thread.start(callback(&sh, &SimpleShell::run));