Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5

Dependencies:   fll mbed-rtos mbed

main.cpp

Committer:
sierra
Date:
2015-02-14
Revision:
4:9ee673ca05ad
Parent:
3:edbf31a8589f
Child:
5:130721ce29f7

File content as of revision 4:9ee673ca05ad:

#include "mbed.h"
#include "rtos.h"
#include "fll.h"

#define FRAME 1.0 / 60 // 1 frame (sec)
#define PULL_PERIOD 20 // millisec

void invoke_sinkrun(const void *p)
{
    ((Sink*)p)->run();
}
void outputrun(const void *p)
{
    ((Output*)p)->run();
}

int main(void)
{
    button_t array[] = {R1|B_CIRCLE, 0};
    // user must make Source
    Source* source = new Source(array, sizeof(array)/sizeof(button_t), true);

    // 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);
}