예제 #1
0
파일: main.cpp 프로젝트: flit/bass.slab
void init_thread(void * arg)
{
    init_board();

    printf("Hello...\r\n");

    init_i2c0();
    init_i2c1();
    init_audio_out();
//     init_fs();
    g_display.init();

    test_prox();

    PinIrqManager::get().connect(PIN_BTN1_PORT, PIN_BTN1_BIT, button_handler, NULL);
    PinIrqManager::get().connect(PIN_BTN2_PORT, PIN_BTN2_BIT, button_handler, NULL);
    PinIrqManager::get().connect(PIN_WAKEUP_PORT, PIN_WAKEUP_BIT, button_handler, NULL);

    PinIrqManager::get().connect(PIN_ENCA_PORT, PIN_ENCA_BIT, rotary_handler, NULL);
    PinIrqManager::get().connect(PIN_ENCB_PORT, PIN_ENCB_BIT, rotary_handler, NULL);

    g_myTimer.start();
    g_audioOut.start();
    g_accelThread.resume();
    g_potsThread.resume();
    g_display.start();

//     delete g_initThread;
}
예제 #2
0
void main(void)
{
//     debug_init();

    printf("Running test...\r\n");

    // (const char * name, thread_entry_t entry, void * param, void * stack, unsigned stackSize, uint8_t priority);
    g_mainThread.init("main", main_thread, 0, 56);
    g_mainThread.resume();

    Ar::Kernel::run();

    Ar::_halt();
}
예제 #3
0
void main_thread(void * arg)
{
    Ar::Thread * self = Ar::Thread::getCurrent();
    const char * myName = self->getName();

    printf("[%s] Main thread is running\r\n", myName);

    g_testCase.init();
    g_testCase.run();

    g_accLock.init("accLock");
    g_x.init("x");
    g_y.init("y");
    g_z.init("z");

    g_xThread.init("x", x_thread, 0, 55);
    g_xThread.resume();

    g_yThread.init("y", y_thread, 0, 55);
    g_yThread.resume();

    g_zThread.init("z", z_thread, 0, 55);
    g_zThread.resume();

    g_blueThread.init("blue", blue_thread, 0, 50);
    g_blueThread.resume();

    g_greenThread.init("green", green_thread, 0, 50);
    g_greenThread.resume();

    g_redThread.init("red", red_thread, 0, 50);
    g_redThread.resume();

    printf("[%s] goodbye!\r\n", myName);
}