Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5
Dependencies: fll mbed-rtos mbed
main.cpp
- Committer:
- sierra
- Date:
- 2015-02-14
- Revision:
- 5:130721ce29f7
- Parent:
- 4:9ee673ca05ad
- Child:
- 6:d0348b7a2f05
File content as of revision 5:130721ce29f7:
#include "mbed.h" #include "rtos.h" #include "fll.h" #define FRAME 1.0 / 60 // 1 frame (sec) class OrPipe : public Pipe { public: OrPipe(Source **srcs, int srcs_size) : Pipe(srcs, srcs_size) {} virtual button_t fold(button_t *bs, int bs_size) { button_t b = 0x00; for(int i = 0; i < bs_size; i++) { b |= bs[i]; } return b; } }; void invoke_sinkrun(const void *p) { ((Sink*)p)->run(); } void outputrun(const void *p) { ((Output*)p)->run(); } int main(void) { button_t array0[] = {R1, 0}; button_t array1[] = {B_CIRCLE, 0}; // user must make Source Source* source0 = new Source(array0, sizeof(array0)/sizeof(button_t), true); Source* source1 = new Source(array1, sizeof(array1)/sizeof(button_t), true); Source* ss[] = {source0, source1}; Source* source = new OrPipe(ss, 2); // common pattern Mail<button_t, MAIL_BOX_SIZE>* mail_box = new Mail<button_t, MAIL_BOX_SIZE>(); Mutex* mutex = new Mutex(); Sink* sink = new Sink(source, mail_box, mutex); Ticker ticker; Output* output = new Output(mail_box); Thread th(invoke_sinkrun, (void *)sink); ticker.attach(output, &Output::run, FRAME); Thread::wait(osWaitForever); }