diff options
| author | hathach <[email protected]> | 2013-04-25 16:41:00 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-04-25 16:41:00 +0700 |
| commit | 3763e22c9a91e9bb21f9fa3dc5dafc9eea6254b7 (patch) | |
| tree | a7dad3f9b4b3b3fd39e381119d6213fb0f7ac0f3 /demos | |
| parent | 1ae548432099fde8ccf9b0be5de899b2168c1f41 (diff) | |
change OSAL_TASK_DEF to decouple variable name with task name
implement osal_task_delay for freeRTOS & non_os
getting both no_os & freertos running with mouse + keyboard
Diffstat (limited to 'demos')
| -rw-r--r-- | demos/host/src/keyboard_app.c | 2 | ||||
| -rw-r--r-- | demos/host/src/main.c | 42 | ||||
| -rw-r--r-- | demos/host/src/mouse_app.c | 2 |
3 files changed, 8 insertions, 38 deletions
diff --git a/demos/host/src/keyboard_app.c b/demos/host/src/keyboard_app.c index 6bf075bb6..e6096d514 100644 --- a/demos/host/src/keyboard_app.c +++ b/demos/host/src/keyboard_app.c @@ -50,7 +50,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -OSAL_TASK_DEF(keyboard_task_def, keyboard_app_task, 128, KEYBOARD_APP_TASK_PRIO); +OSAL_TASK_DEF(keyboard_task_def, "keyboard app", keyboard_app_task, 128, KEYBOARD_APP_TASK_PRIO); OSAL_QUEUE_DEF(queue_kbd_report, QUEUE_KEYBOARD_REPORT_DEPTH, tusb_keyboard_report_t); static osal_queue_handle_t q_kbd_report_hdl; diff --git a/demos/host/src/main.c b/demos/host/src/main.c index f3fd13f1d..aee0474d7 100644 --- a/demos/host/src/main.c +++ b/demos/host/src/main.c @@ -67,7 +67,7 @@ void print_greeting(void); OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para); -OSAL_TASK_DEF(led_blinking_task_def, led_blinking_task, 128, LED_BLINKING_APP_TASK_PRIO); +OSAL_TASK_DEF(led_blinking_task_def, "led blinking", led_blinking_task, 128, LED_BLINKING_APP_TASK_PRIO); //--------------------------------------------------------------------+ // IMPLEMENTATION @@ -132,48 +132,18 @@ void print_greeting(void) OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para) { + static uint32_t led_on_mask = 0; + #if TUSB_CFG_OS != TUSB_OS_NONE // TODO abstract to approriate place print_greeting(); #endif OSAL_TASK_LOOP_BEGIN - vTaskDelay(CFG_TICKS_PER_SECOND); + osal_task_delay(1000); - /* Toggle LED once per second */ - if ( (xTaskGetTickCount()/CFG_TICKS_PER_SECOND) % 2) - { - board_leds(0x01, 0x00); - } - else - { - board_leds(0x00, 0x01); - } + board_leds(led_on_mask, 1 - led_on_mask); + led_on_mask = 1 - led_on_mask; // toggle OSAL_TASK_LOOP_END } - -//OSAL_TASK_FUNCTION( led_blinking_task ) (void* p_task_para) -//{ -// static uint32_t current_tick = 0; -// -// OSAL_TASK_LOOP_BEGIN -// -// if (current_tick + CFG_TICKS_PER_SECOND < system_ticks) -// { -// current_tick += CFG_TICKS_PER_SECOND; -// -// /* Toggle LED once per second */ -// if ( (current_tick/CFG_TICKS_PER_SECOND) % 2) -// { -// board_leds(0x01, 0x00); -// } -// else -// { -// board_leds(0x00, 0x01); -// } -// } -// -// OSAL_TASK_LOOP_END -//} - diff --git a/demos/host/src/mouse_app.c b/demos/host/src/mouse_app.c index 18ebe4e68..cb529fc7c 100644 --- a/demos/host/src/mouse_app.c +++ b/demos/host/src/mouse_app.c @@ -50,7 +50,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -OSAL_TASK_DEF(mouse_task_def, mouse_app_task, 128, MOUSE_APP_TASK_PRIO); +OSAL_TASK_DEF(mouse_task_def, "mouse app", mouse_app_task, 128, MOUSE_APP_TASK_PRIO); OSAL_QUEUE_DEF(queue_mouse_report, QUEUE_MOUSE_REPORT_DEPTH, tusb_mouse_report_t); static osal_queue_handle_t q_mouse_report_hdl; |
