Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5

Dependencies:   fll mbed-rtos mbed

Committer:
sierra
Date:
Sat Feb 14 06:49:42 2015 +0000
Revision:
4:9ee673ca05ad
Parent:
3:edbf31a8589f
Child:
5:130721ce29f7
Sink is now a thread

Who changed what in which revision?

UserRevisionLine numberNew contents of line
amutake 0:c80e972b4c59 1 #include "mbed.h"
amutake 0:c80e972b4c59 2 #include "rtos.h"
amutake 0:c80e972b4c59 3 #include "fll.h"
amutake 0:c80e972b4c59 4
amutake 0:c80e972b4c59 5 #define FRAME 1.0 / 60 // 1 frame (sec)
sierra 3:edbf31a8589f 6 #define PULL_PERIOD 20 // millisec
amutake 0:c80e972b4c59 7
sierra 4:9ee673ca05ad 8 void invoke_sinkrun(const void *p)
amutake 0:c80e972b4c59 9 {
amutake 0:c80e972b4c59 10 ((Sink*)p)->run();
amutake 0:c80e972b4c59 11 }
amutake 0:c80e972b4c59 12 void outputrun(const void *p)
amutake 0:c80e972b4c59 13 {
amutake 0:c80e972b4c59 14 ((Output*)p)->run();
amutake 0:c80e972b4c59 15 }
amutake 0:c80e972b4c59 16
amutake 0:c80e972b4c59 17 int main(void)
amutake 0:c80e972b4c59 18 {
sierra 3:edbf31a8589f 19 button_t array[] = {R1|B_CIRCLE, 0};
amutake 0:c80e972b4c59 20 // user must make Source
sierra 3:edbf31a8589f 21 Source* source = new Source(array, sizeof(array)/sizeof(button_t), true);
amutake 0:c80e972b4c59 22
amutake 0:c80e972b4c59 23 // common pattern
sierra 3:edbf31a8589f 24 Mail<button_t, MAIL_BOX_SIZE>* mail_box = new Mail<button_t, MAIL_BOX_SIZE>();
amutake 0:c80e972b4c59 25 Mutex* mutex = new Mutex();
amutake 0:c80e972b4c59 26
amutake 2:165723d41023 27 Sink* sink = new Sink(source, mail_box, mutex);
amutake 0:c80e972b4c59 28
amutake 0:c80e972b4c59 29 Ticker ticker;
amutake 2:165723d41023 30 Output* output = new Output(mail_box);
amutake 0:c80e972b4c59 31
sierra 4:9ee673ca05ad 32 Thread th(invoke_sinkrun, (void *)sink);
amutake 0:c80e972b4c59 33 ticker.attach(output, &Output::run, FRAME);
amutake 0:c80e972b4c59 34
sierra 1:1abcd83947bf 35 Thread::wait(osWaitForever);
amutake 0:c80e972b4c59 36 }