Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5
Dependencies: fll mbed-rtos mbed
main.cpp
- Committer:
- sierra
- Date:
- 2015-02-14
- Revision:
- 6:d0348b7a2f05
- Parent:
- 5:130721ce29f7
- Child:
- 7:61b4825304e2
- Child:
- 29:2f3d6d09eaac
File content as of revision 6:d0348b7a2f05:
#include "mbed.h" #include "rtos.h" #include "fll.h" #define FRAME 1.0 / 60 // 1 frame (sec) class OrFoldFlow : public FoldFlow { public: OrFoldFlow(Producer **srcs, int srcs_size) : FoldFlow(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 Producer* source0 = new RepeaterSource(array0, sizeof(array0)/sizeof(button_t)); Producer* source1 = new RepeaterSource(array1, sizeof(array1)/sizeof(button_t)); Producer* ss[] = {source0, source1}; Producer* source = new OrFoldFlow(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); }