diff options
author | Joel Bodenman <joel@unormal.org> | 2014-05-04 17:30:24 +0200 |
---|---|---|
committer | Joel Bodenman <joel@unormal.org> | 2014-05-04 17:30:24 +0200 |
commit | 1a0d1f1d1097ade825cdabbd693ebf7f48dcee77 (patch) | |
tree | e683226ede1f598efe8a30a5fb595627b0adaa53 | |
parent | 33c721c009465dd30d4e96e055a051480c567b57 (diff) | |
parent | 2ef393d35b579325666797b67969c6dc94d161f9 (diff) | |
download | uGFX-1a0d1f1d1097ade825cdabbd693ebf7f48dcee77.tar.gz uGFX-1a0d1f1d1097ade825cdabbd693ebf7f48dcee77.tar.bz2 uGFX-1a0d1f1d1097ade825cdabbd693ebf7f48dcee77.zip |
Merged in winfred_lu/ugfx/freertos (pull request #6)
Fix some typos and implement gfxSleepMilliseconds().
-rw-r--r-- | src/gos/freertos.c | 35 | ||||
-rw-r--r-- | src/gos/freertos.h | 3 | ||||
-rw-r--r-- | src/gos/sys_options.h | 12 |
3 files changed, 18 insertions, 32 deletions
diff --git a/src/gos/freertos.c b/src/gos/freertos.c index e3be4f28..ce831a4c 100644 --- a/src/gos/freertos.c +++ b/src/gos/freertos.c @@ -28,7 +28,11 @@ void _gosInit(void) { - // The user must call vTaskStartScheduler() himself before he calls gfxInit(). + // The user must call vTaskStartScheduler() himself before he calls gfxInit(). +} + +void _gosDeinit(void) +{ } void* gfxRealloc(void *ptr, size_t oldsz, size_t newsz) @@ -52,30 +56,24 @@ void* gfxRealloc(void *ptr, size_t oldsz, size_t newsz) void gfxSleepMilliseconds(delaytime_t ms) { - // Implement this + const portTickType ticks = ms / portTICK_PERIOD_MS; + vTaskDelay(ticks); } void gfxSleepMicroseconds(delaytime_t ms) { - // Implement this + const portTickType ticks = (ms / 1000) / portTICK_PERIOD_MS; + + // delay milli seconds + vTaskDelay(ticks); + + // microsecond resolution delay is not supported in FreeRTOS + // vUsDelay(ms%1000); } portTickType MS2ST(portTickType ms) { - // Verify this - - uint64_t val; - - if (configTICK_RATE_HZ == 1000) { // gain time because no test to do in most case - return ms; - } - - val = ms; - val *= configTICK_RATE_HZ; - val += 999; - val /= 1000; - - return val; + return (ms / portTICK_PERIOD_MS); } void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit) @@ -152,7 +150,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_ if (stacksz < configMINIMAL_STACK_SIZE) stacksz = configMINIMAL_STACK_SIZE; - if (xTaskCreate(fn, (signed char*)"uGFX_TASK", stacksz, param, prio, &task )!= pdPASS) { + if (xTaskCreate(fn, "uGFX_TASK", stacksz, param, prio, &task )!= pdPASS) { for (;;); } @@ -161,4 +159,3 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_ #endif /* GFX_USE_OS_FREERTOS */ /** @} */ - diff --git a/src/gos/freertos.h b/src/gos/freertos.h index f15ca910..7fa9ee4f 100644 --- a/src/gos/freertos.h +++ b/src/gos/freertos.h @@ -59,7 +59,7 @@ typedef struct { } gfxSem; typedef xSemaphoreHandle gfxMutex; -typedef xTaskHandl* gfxThreadHandle; +typedef xTaskHandle* gfxThreadHandle; /*===========================================================================*/ /* Function declarations. */ @@ -111,4 +111,3 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_ #endif /* GFX_USE_OS_FREERTOS */ #endif /* _GOS_CHIBIOS_H */ - diff --git a/src/gos/sys_options.h b/src/gos/sys_options.h index 9d2e735f..90a5bc91 100644 --- a/src/gos/sys_options.h +++ b/src/gos/sys_options.h @@ -42,17 +42,7 @@ #define GFX_USE_OS_WIN32 FALSE #endif /** - * @brief Use a linux based system running X11 - * @details Defaults to FALSE - /** - * @brief Use Win32 - * @details Defaults to FALSE - */ - #ifndef GFX_USE_OS_WIN32 - #define GFX_USE_OS_WIN32 FALSE - #endif - /** - * @brief Use a linux based system running X11 + * @brief Use a linux based system running X11 * @details Defaults to FALSE */ #ifndef GFX_USE_OS_LINUX |