diff options
author | Keith Packard <keithp@keithp.com> | 2009-04-13 21:51:59 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-04-13 21:51:59 -0700 |
commit | b56a44e48552bc32dbba9ff21770c370219a684a (patch) | |
tree | 00c759a9aea00333525312c76efe6ee9dc172945 /ao_test.c | |
parent | cdaf3fc5802acf2ddc7972a15649ab0e1b31b873 (diff) |
Fix USB input/output by reloading packet limits.
The USB controller is reset during the connection process, which clears the
packet limits set in the controller at initialization time. Reload those
values when the configuration is set.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao_test.c')
-rw-r--r-- | ao_test.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -21,6 +21,7 @@ struct ao_task __xdata blink_0_task; struct ao_task __xdata blink_1_task; struct ao_task __xdata wakeup_task; struct ao_task __xdata beep_task; +struct ao_task __xdata echo_task; void delay(int n) __reentrant { @@ -84,6 +85,19 @@ beep(void) } void +echo(void) +{ + uint8_t c; + for (;;) { + c = ao_usb_getchar(); + ao_usb_putchar(c); + if (c == '\r') + ao_usb_putchar('\n'); + ao_usb_flush(); + } +} + +void main(void) { CLKCON = 0; @@ -94,5 +108,6 @@ main(void) ao_add_task(&blink_1_task, blink_1); ao_add_task(&wakeup_task, wakeup); ao_add_task(&beep_task, beep); + ao_add_task(&echo_task, echo); ao_start_scheduler(); } |