summaryrefslogtreecommitdiff
path: root/examples/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-11-17 13:26:14 +0700
committerhathach <[email protected]>2018-11-17 13:26:14 +0700
commit4e2c357579629c10bad92f2f76161b2073fab107 (patch)
tree23a64443f0dd8165b8a46d8d86ad71bd1795f336 /examples/device
parent99f758ecd9bffd0c8da35e5ffd906eb09e5fb7f7 (diff)
clean up
Diffstat (limited to 'examples/device')
-rw-r--r--examples/device/device_composite/src/main.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/examples/device/device_composite/src/main.c b/examples/device/device_composite/src/main.c
index 11b73ebf9..4c8730242 100644
--- a/examples/device/device_composite/src/main.c
+++ b/examples/device/device_composite/src/main.c
@@ -36,9 +36,6 @@
*/
/**************************************************************************/
-//--------------------------------------------------------------------+
-// INCLUDE
-//--------------------------------------------------------------------+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -47,15 +44,39 @@
#include "tusb.h"
//--------------------------------------------------------------------+
-// MACRO CONSTANT TYPEDEF
-//--------------------------------------------------------------------+
-
-//--------------------------------------------------------------------+
-// INTERNAL OBJECT & FUNCTION DECLARATION
+// MACRO CONSTANT TYPEDEF PROTYPES
//--------------------------------------------------------------------+
void print_greeting(void);
void led_blinking_task(void);
+/*------------- MAIN -------------*/
+int main(void)
+{
+ board_init();
+ print_greeting();
+
+ tusb_init();
+
+ while (1)
+ {
+ tusb_task();
+
+ led_blinking_task();
+
+#if CFG_TUD_CDC
+ extern void virtual_com_task(void);
+ virtual_com_task();
+#endif
+
+#if CFG_TUD_HID
+ extern void usb_hid_task(void);
+ usb_hid_task();
+#endif
+ }
+
+ return 0;
+}
+
//--------------------------------------------------------------------+
// USB CDC
//--------------------------------------------------------------------+
@@ -90,8 +111,6 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
tud_cdc_write_str("tinyusb usb cdc\n");
}
}
-#else
-#define virtual_com_task()
#endif
//--------------------------------------------------------------------+
@@ -151,32 +170,8 @@ void tud_hid_generic_set_report_cb(uint8_t report_id, hid_report_type_t report_t
{
// TODO not Implemented
}
-
-#else
-#define usb_hid_task()
#endif
-
-/*------------- MAIN -------------*/
-int main(void)
-{
- board_init();
- print_greeting();
-
- tusb_init();
-
- while (1)
- {
- tusb_task();
-
- led_blinking_task();
- virtual_com_task();
- usb_hid_task();
- }
-
- return 0;
-}
-
//--------------------------------------------------------------------+
// tinyusb callbacks
//--------------------------------------------------------------------+