程式語言 - uC/GUI - Create Timer



參考資訊:
https://github.com/piyushpandey013/ucGUI
https://github.com/yongzhena/ucgui-linux

main.c

#include <stdio.h>
#include <stdlib.h>
  
#include "GUI.h"
 
static void timer_handler(GUI_TIMER_MESSAGE* pTM)
{
    printf("call %s()\n", __func__);
}
 
int main(int argc, char *argv[])
{
    GUI_TIMER_HANDLE hTimer = 0;

    GUI_Init();
    GUI_SetBkColor(GUI_GRAY);
    GUI_Clear();

    hTimer = GUI_TIMER_Create(timer_handler, GUI_GetTime() + 1000, 0, 0); 
    GUI_Delay(3000);
    GUI_TIMER_Delete(hTimer);
    return 0;
}

編譯、執行

$ gcc main.c -o main libucgui.a -IGUI_X -IGUI/Core -IGUI/Widget -IGUI/WM -lSDL
$ ./main
    call timer_handler()