Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5

Dependencies:   fll mbed-rtos mbed

Committer:
sierra
Date:
Fri Feb 13 14:41:00 2015 +0000
Revision:
1:1abcd83947bf
Parent:
0:c80e972b4c59
Child:
2:165723d41023
Works fine now

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)
amutake 0:c80e972b4c59 6 #define PULL_PERIOD 100 // millisec
amutake 0:c80e972b4c59 7
amutake 0:c80e972b4c59 8 void 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 1:1abcd83947bf 19 button array[] = {R1|B_CIRCLE, 0};
amutake 0:c80e972b4c59 20 // user must make Source
sierra 1:1abcd83947bf 21 Source* source = new Source(array, sizeof(array)/sizeof(button), true);
amutake 0:c80e972b4c59 22
amutake 0:c80e972b4c59 23 // common pattern
amutake 0:c80e972b4c59 24 Mail<button, QUEUE_SIZE>* btnQueue = new Mail<button, QUEUE_SIZE>();
amutake 0:c80e972b4c59 25 Mutex* mutex = new Mutex();
amutake 0:c80e972b4c59 26
amutake 0:c80e972b4c59 27 Sink* sink = new Sink(source, btnQueue, mutex);
amutake 0:c80e972b4c59 28 rtos::RtosTimer buffer(sinkrun, osTimerPeriodic, (void *)sink);
amutake 0:c80e972b4c59 29
amutake 0:c80e972b4c59 30 Ticker ticker;
amutake 0:c80e972b4c59 31 Output* output = new Output(btnQueue);
amutake 0:c80e972b4c59 32
amutake 0:c80e972b4c59 33 buffer.start(PULL_PERIOD);
amutake 0:c80e972b4c59 34 ticker.attach(output, &Output::run, FRAME);
amutake 0:c80e972b4c59 35
sierra 1:1abcd83947bf 36 Thread::wait(osWaitForever);
amutake 0:c80e972b4c59 37 }