Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5
Dependencies: fll mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:c80e972b4c59
- Child:
- 1:1abcd83947bf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 13 13:19:29 2015 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" +#include "rtos.h" +#include "fll.h" + +#define FRAME 1.0 / 60 // 1 frame (sec) +#define PULL_PERIOD 100 // millisec + +void sinkrun(const void *p) +{ + ((Sink*)p)->run(); +} +void outputrun(const void *p) +{ + ((Output*)p)->run(); +} + +int main(void) +{ + std::vector<button> vec(B_CIRCLE); + // user must make Source + Source* source = new Source(&vec, true); + + // common pattern + Mail<button, QUEUE_SIZE>* btnQueue = new Mail<button, QUEUE_SIZE>(); + Mutex* mutex = new Mutex(); + + Sink* sink = new Sink(source, btnQueue, mutex); + rtos::RtosTimer buffer(sinkrun, osTimerPeriodic, (void *)sink); + + Ticker ticker; + Output* output = new Output(btnQueue); + + buffer.start(PULL_PERIOD); + ticker.attach(output, &Output::run, FRAME); + + while (true) {} // ? +}