diff options
| author | hathach <[email protected]> | 2018-02-28 14:59:38 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-02-28 14:59:38 +0700 |
| commit | 65a076f1981ae123568c66ec06d90b26707dac9e (patch) | |
| tree | c6caa5488da2d1adacc6cbcdf8e71d08ac1427d9 /demos/device/src | |
| parent | 9bf083d44929564141d5c092d63cc2053358f794 (diff) | |
more clean up
Diffstat (limited to 'demos/device/src')
| -rw-r--r-- | demos/device/src/cdc_device_app.c | 11 | ||||
| -rw-r--r-- | demos/device/src/keyboard_device_app.c | 12 | ||||
| -rw-r--r-- | demos/device/src/mouse_device_app.c | 12 |
3 files changed, 30 insertions, 5 deletions
diff --git a/demos/device/src/cdc_device_app.c b/demos/device/src/cdc_device_app.c index 209cefba3..f7008585c 100644 --- a/demos/device/src/cdc_device_app.c +++ b/demos/device/src/cdc_device_app.c @@ -121,11 +121,20 @@ void cdcd_serial_app_init(void) osal_task_create(cdcd_serial_app_task, "cdc", 128, NULL, CDC_SERIAL_APP_TASK_PRIO, NULL);
}
+tusb_error_t cdcd_serial_subtask(void);
+
void cdcd_serial_app_task(void* param)
{
(void) param;
OSAL_TASK_LOOP_BEGIN
+ cdcd_serial_subtask();
+ OSAL_TASK_LOOP_END
+}
+
+tusb_error_t cdcd_serial_subtask(void)
+{
+ OSAL_SUBTASK_BEGIN
tusb_error_t error;
@@ -153,7 +162,7 @@ void cdcd_serial_app_task(void* param) tusbd_cdc_receive(0, serial_rx_buffer, SERIAL_BUFFER_SIZE, true);
}
- OSAL_TASK_LOOP_END
+ OSAL_SUBTASK_END
}
#endif
diff --git a/demos/device/src/keyboard_device_app.c b/demos/device/src/keyboard_device_app.c index dc3707559..7f0417fa9 100644 --- a/demos/device/src/keyboard_device_app.c +++ b/demos/device/src/keyboard_device_app.c @@ -109,11 +109,20 @@ void keyboard_device_app_init(void) osal_task_create(keyboard_device_app_task, "kbd", 128, NULL, KEYBOARD_APP_TASK_PRIO, NULL);
}
+tusb_error_t keyboard_device_subtask(void);
+
void keyboard_device_app_task(void* param)
{
(void) param;
OSAL_TASK_LOOP_BEGIN
+ keyboard_device_subtask();
+ OSAL_TASK_LOOP_END
+}
+
+tusb_error_t keyboard_device_subtask(void)
+{
+ OSAL_SUBTASK_BEGIN
osal_task_delay(50);
@@ -136,8 +145,7 @@ void keyboard_device_app_task(void* param) }
}
-
- OSAL_TASK_LOOP_END
+ OSAL_SUBTASK_END
}
#endif
diff --git a/demos/device/src/mouse_device_app.c b/demos/device/src/mouse_device_app.c index 8f395d901..6addbd3dc 100644 --- a/demos/device/src/mouse_device_app.c +++ b/demos/device/src/mouse_device_app.c @@ -98,11 +98,19 @@ void mouse_device_app_init(void) osal_task_create(mouse_device_app_task, "mouse", 128, NULL, MOUSE_APP_TASK_PRIO, NULL);
}
+void mouse_device_subtask(void);
+
void mouse_device_app_task(void * param)
{
(void) para;
-
OSAL_TASK_LOOP_BEGIN
+ mouse_device_subtask();
+ OSAL_TASK_LOOP_END
+}
+
+void mouse_device_subtask(void)
+{
+ OSAL_SUBTASK_BEGIN
osal_task_delay(20);
@@ -143,7 +151,7 @@ void mouse_device_app_task(void * param) }
}
- OSAL_TASK_LOOP_END
+ OSAL_SUBTASK_END
}
#endif
|
