Auto full-combo Koibumi2000 in Taiko no Tatsujin CS5

Dependencies:   fll mbed-rtos mbed

main.cpp

Committer:
amutake
Date:
2015-02-14
Revision:
2:165723d41023
Parent:
1:1abcd83947bf
Child:
3:edbf31a8589f

File content as of revision 2:165723d41023:

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

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

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

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

    // common pattern
    Mail<button, MAIL_BOX_SIZE>* mail_box = new Mail<button, MAIL_BOX_SIZE>();
    Mutex* mutex = new Mutex();

    Sink* sink = new Sink(source, mail_box, mutex);
    rtos::RtosTimer buffer(sinkrun, osTimerPeriodic, (void *)sink);

    Ticker ticker;
    Output* output = new Output(mail_box);

    buffer.start(PULL_PERIOD);
    ticker.attach(output, &Output::run, FRAME);

    Thread::wait(osWaitForever);
}