示例#1
0
/* Led线程的线程主函数 */
static void ThreadLed2Entry(TArgument data)
{
    TError error;
    TState state;

    while (eTrue)
    {
        state = TclDelayThread(TCLM_SEC2TICKS(200), &error);
        if(state == eSuccess)
        {
            EvbLedControl(LED2, LED_OFF);
        }

        state = TclDelayThread(TCLM_SEC2TICKS(200), &error);
        if(state == eSuccess)
        {
            EvbLedControl(LED2, LED_ON);
        }
    }
}
示例#2
0
/* Led线程的线程主函数 */
static void ThreadLedEntry(TArgument data)
{
    TError error;
    TState state;
    TThread* pThread;

    /* 参数2为线程的内核参数,由内核自动设置为当前线程的地址 */
    pThread = (TThread*)data;
    while (eTrue)
    {
        EvbLedControl(LED1, LED_ON);
        state = TclDelayThread(pThread, TCLM_SEC2TICKS(1), &error);
        TCLM_ASSERT((state == eSuccess), "");
        TCLM_ASSERT((error == TCLE_THREAD_NONE), "");

        EvbLedControl(LED1, LED_OFF);
        state = TclDelayThread(pThread, TCLM_SEC2TICKS(1), &error);
        TCLM_ASSERT((state == eSuccess), "");
        TCLM_ASSERT((error == TCLE_THREAD_NONE), "");
    }
}