diff options
author | Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> | 2024-03-05 01:05:31 -0300 |
---|---|---|
committer | Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> | 2024-03-08 06:51:34 -0300 |
commit | 35c0a4be8776779cf44648db061d7f854627ccc1 (patch) | |
tree | 5626ec6a8596dd497ce198eeee4ad0bcf4858149 /watch-library/shared | |
parent | 592e18bf0eabfa0dd37a53ce66de5ca29ceef747 (diff) | |
parent | 5b762d016841acb3cefa60f05e963711f0a3eb2b (diff) | |
download | Sensor-Watch-35c0a4be8776779cf44648db061d7f854627ccc1.tar.gz Sensor-Watch-35c0a4be8776779cf44648db061d7f854627ccc1.tar.bz2 Sensor-Watch-35c0a4be8776779cf44648db061d7f854627ccc1.zip |
Merge branch 'usb-improvements' into advanced
- Change newline prints to also send carriage return
- Introduce shell module for serial shell with argument parsing
- Introduce shell command list for compile time command registration
- Refactor file system commands for shell subsystem
- Introduce new shell commands:
- 'help' command
- 'flash' command to reset into bootloader
- 'stress' tests CDC serial writes of various lengths
- optional delay parameter
- Harden USB handling
- Hangs less
- Drops fewer inputs
- Circular buffers for both reads and writes
Reported-by: Edward Shin <contact@edwardsh.in>
Tested-by: Edward Shin <contact@edwardsh.in>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Reviewed-by: James Haggerty <james@gruemail.com>
Reviewed-by: Wesley Aptekar-Cassels <me@wesleyac.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/344
Diffstat (limited to 'watch-library/shared')
-rw-r--r-- | watch-library/shared/watch/watch.h | 4 | ||||
-rw-r--r-- | watch-library/shared/watch/watch_private.h | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/watch-library/shared/watch/watch.h b/watch-library/shared/watch/watch.h index d23954ec..62e57a59 100644 --- a/watch-library/shared/watch/watch.h +++ b/watch-library/shared/watch/watch.h @@ -88,6 +88,10 @@ bool watch_is_usb_enabled(void); */ void watch_reset_to_bootloader(void); +/** @brief Call periodically from app main loop to service CDC RX/TX. + */ +void cdc_task(void); + /** @brief Reads up to len bytes from the USB serial. * @param file ignored, you can pass in 0 * @param ptr pointer to a buffer of at least len bytes diff --git a/watch-library/shared/watch/watch_private.h b/watch-library/shared/watch/watch_private.h index 9d55bc21..8fcc5755 100644 --- a/watch-library/shared/watch/watch_private.h +++ b/watch-library/shared/watch/watch_private.h @@ -38,14 +38,19 @@ void _watch_enable_tcc(void); /// Called by buzzer and LED teardown functions. You should not call this from your app. void _watch_disable_tcc(void); -/// Called by main.c if plugged in to USB. You should not call this from your app. -void _watch_enable_usb(void); +/// Enable USB task timer. Called by USB enable routine in main(). You should not call this from your app. +void _watch_enable_tc0(void); + +/// Disable USB task timer. You should not call this from your app. +void _watch_disable_tc0(void); -// this function ends up getting called by printf to log stuff to the USB console. -int _write(int file, char *ptr, int len); +/// Enable CDC task timer. Called by USB enable routine in main(). You should not call this from your app. +void _watch_enable_tc1(void); -// i thought this would be called by gets but it doesn't? anyway it does get called by read() -// so that's our mechanism for reading data from the USB serial console. -int _read(int file, char *ptr, int len); +/// Disable CDC task timer. You should not call this from your app. +void _watch_disable_tc1(void); + +/// Called by main.c if plugged in to USB. You should not call this from your app. +void _watch_enable_usb(void); #endif |