summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-06-03 14:37:41 +0700
committerhathach <[email protected]>2013-06-03 14:37:41 +0700
commit52f18f37848615b9ebe8d749c16eea114b24f524 (patch)
tree8941fc7f468005afc4f681a6e69321dddae86004 /demos
parentb527e6ec4a9d0b6ecad5a6ce74b27458d1cd24be (diff)
refractor device mouse main.c & tusbd_hid_mouse_send_report
Diffstat (limited to 'demos')
-rw-r--r--demos/device/keyboard/main.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/demos/device/keyboard/main.c b/demos/device/keyboard/main.c
index 8f4d263ac..c0f0b2ac0 100644
--- a/demos/device/keyboard/main.c
+++ b/demos/device/keyboard/main.c
@@ -18,6 +18,7 @@ void print_greeting(void);
void led_blinking_task(void * p_para);
void keyboard_device_app_task(void * p_para);
+void mouse_device_app_task(void * p_para);
int main(void)
{
@@ -40,15 +41,7 @@ int main(void)
#endif
#if TUSB_CFG_DEVICE_HID_MOUSE
- if (usb_isConfigured())
- {
- static uint32_t count =0;
- if (count < 8)
- {
- count++;
- tusb_hid_mouse_send(0, 20, 20);
- }
- }
+ mouse_device_app_task(NULL);
#endif
}
@@ -116,6 +109,24 @@ void keyboard_device_app_task(void * p_para)
}
#endif
+#if TUSB_CFG_DEVICE_HID_MOUSE
+void mouse_device_app_task(void * p_para)
+{
+ if (usb_isConfigured())
+ {
+ static uint32_t count =0;
+ if (count < 8)
+ {
+ count++;
+ tusbd_hid_mouse_send_report(
+ &(tusb_mouse_report_t) {
+ .x = 20,
+ .y = 20 } );
+ }
+ }
+}
+#endif
+
//--------------------------------------------------------------------+
// HELPER FUNCTION
//--------------------------------------------------------------------+