仿照GUI_X_FreeRTOS.c编制GUI_X_RTT.c文件,在STM32F4探索者上移植RT-Thread + STemWin5.26成功。
#include "GUI.h" #include "rtthread.h" static rt_mutex_t queue_mutex; static rt_mutex_t tx_done_mutex; int GUI_X_GetTime(void) { return ((int) rt_tick_get()); } void GUI_X_Delay(int ms) { rt_thread_delay( ms ); } void GUI_X_Init(void) { } void GUI_X_ExecIdle(void) { } void GUI_X_InitOS(void) { queue_mutex= rt_mutex_create("q_mutex", RT_IPC_FLAG_FIFO); tx_done_mutex= rt_mutex_create("tx_mutex", RT_IPC_FLAG_FIFO); } void GUI_X_Unlock(void) { rt_mutex_release(queue_mutex); } void GUI_X_Lock(void) { rt_mutex_take(queue_mutex,RT_WAITING_FOREVER); } /* Get Task handle */ U32 GUI_X_GetTaskId(void) { return ((U32) rt_thread_self()); } void GUI_X_WaitEvent (void) { rt_mutex_take(tx_done_mutex,RT_WAITING_FOREVER); } void GUI_X_SignalEvent (void) { rt_mutex_release(tx_done_mutex); } void GUI_X_Log (const char *s) { } void GUI_X_Warn (const char *s) { } void GUI_X_ErrorOut(const char *s) { }
|