File tree Expand file tree Collapse file tree 1 file changed +17
-18
lines changed Expand file tree Collapse file tree 1 file changed +17
-18
lines changed Original file line number Diff line number Diff line change 22
22
// Weak empty variant initialization function.
23
23
// May be redefined by variant files.
24
24
void initVariant () __attribute__((weak));
25
- void initVariant () { }
25
+ void initVariant () {}
26
+ #if defined(USE_TINYUSB)
27
+ // run TinyUSB background task auto This method will be overridden when running in FreeRTOS
28
+ void __attribute__ ((weak)) tinyusb_task(void )
29
+ {
30
+ }
31
+ #endif
26
32
27
33
/*
28
34
* _real_body(),_wrap_body() is a compiler trick,
29
35
* user could overwrite the arduino setup/loop function by re-implement _wrap_body(),
30
36
* calling of _real_body() in _wrap_body() is optional.
31
37
*/
32
- void _real_body (){
38
+ void _real_body ()
39
+ {
33
40
setup ();
34
-
41
+ #if defined(USE_TINYUSB)
42
+ tinyusb_task ();
43
+ #endif
35
44
for (;;)
36
45
{
37
46
loop ();
38
47
yield (); // yield run usb background task
39
-
40
- if (serialEventRun) serialEventRun ();
48
+ if (serialEventRun)
49
+ serialEventRun ();
41
50
}
42
51
}
43
52
44
- void __attribute__ ((weak)) _wrap_body(){
53
+ void __attribute__ ((weak)) _wrap_body()
54
+ {
45
55
_real_body ();
46
56
}
47
57
@@ -51,7 +61,7 @@ extern "C" void __libc_init_array(void);
51
61
/*
52
62
* \brief Main entry point of Arduino application
53
63
*/
54
- int main ( void )
64
+ int main (void )
55
65
{
56
66
init ();
57
67
@@ -70,14 +80,3 @@ int main( void )
70
80
_wrap_body ();
71
81
return 0 ;
72
82
}
73
-
74
- #if defined(USE_TINYUSB)
75
-
76
- // run TinyUSB background task when yield()
77
- extern " C" void yield (void )
78
- {
79
- tud_task ();
80
- tud_cdc_write_flush ();
81
- }
82
-
83
- #endif
You can’t perform that action at this time.
0 commit comments