16
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
17
*/
18
18
19
+ #include <stdint.h>
19
20
/**
20
21
* Empty yield() hook.
21
22
*
25
26
* Its defined as a weak symbol and it can be redefined to implement a
26
27
* real cooperative scheduler.
27
28
*/
28
- static void __empty () {
29
- // Empty
29
+ extern void tud_task (void );
30
+ extern uint32_t tud_cdc_n_write_flush (uint8_t itf );
31
+ static void __empty ()
32
+ {
33
+ // Empty
34
+ #if defined(USE_TINYUSB )
35
+ tud_task ();
36
+ tud_cdc_n_write_flush (0 );
37
+ #endif
30
38
}
31
-
32
- void yield (void ) __attribute__ ((weak , alias ("__empty" )));
39
+ void yield (void ) __attribute__((weak , alias ("__empty" )));
33
40
34
41
/**
35
42
* SysTick hook
36
43
*
37
44
* This function is called from SysTick handler, before the default
38
45
* handler provided by Arduino.
39
46
*/
40
- static int __false () {
41
- // Return false
42
- return 0 ;
47
+ static int __false ()
48
+ {
49
+ // Return false
50
+ return 0 ;
43
51
}
44
- int sysTickHook (void ) __attribute__ ((weak , alias ("__false" )));
52
+ int sysTickHook (void ) __attribute__((weak , alias ("__false" )));
45
53
46
54
/**
47
55
* SVC hook
@@ -50,10 +58,11 @@ int sysTickHook(void) __attribute__ ((weak, alias("__false")));
50
58
* These functions are called from SVC handler, and PensSV handler.
51
59
* Default action is halting.
52
60
*/
53
- static void __halt () {
54
- // Halts
55
- while (1 )
56
- ;
61
+ static void __halt ()
62
+ {
63
+ // Halts
64
+ while (1 )
65
+ ;
57
66
}
58
- void svcHook (void ) __attribute__ ((weak , alias ("__halt" )));
59
- void pendSVHook (void ) __attribute__ ((weak , alias ("__halt" )));
67
+ void svcHook (void ) __attribute__((weak , alias ("__halt" )));
68
+ void pendSVHook (void ) __attribute__((weak , alias ("__halt" )));
0 commit comments