Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5
Dependencies: fll mbed-rtos mbed
main.cpp@3:edbf31a8589f, 2015-02-14 (annotated)
- Committer:
- sierra
- Date:
- Sat Feb 14 06:39:14 2015 +0000
- Revision:
- 3:edbf31a8589f
- Parent:
- 2:165723d41023
- Child:
- 4:9ee673ca05ad
change button to button_t; optimize something
Who changed what in which revision?
User | Revision | Line number | New 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 | |
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 | 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 | rtos::RtosTimer buffer(sinkrun, osTimerPeriodic, (void *)sink); |
amutake | 0:c80e972b4c59 | 29 | |
amutake | 0:c80e972b4c59 | 30 | Ticker ticker; |
amutake | 2:165723d41023 | 31 | Output* output = new Output(mail_box); |
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 | } |