diff options
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | examples/device/cdc_msc_hid/src/main.c | 19 | ||||
| -rw-r--r-- | src/device/usbd.h | 11 |
3 files changed, 18 insertions, 18 deletions
@@ -47,15 +47,15 @@ Currently the following OS are supported with tinyusb out of the box with a simp The stack supports the following MCUs - **Nordic:** nRF52840 -- **NXP:** LPC11Uxx, LPC13xx, LPC175x_6x, LPC177x_8x, LPC40xx, LPC43xx -- **MicroChip:** SAMD21, SAMD51 (device only) +- **NXP:** LPC11Uxx, LPC13xx, LPC175x_6x, LPC177x_8x, LPC18xx, LPC40xx, LPC43xx +- **MicroChip:** SAMD21, SAMD51 - **ST:** STM32F4 [Here is the list of supported Boards](docs/boards.md) ## Compiler & IDE -The stack is developed with GCC compiler, and should be compilable with others. However, it requires C99 to build with. Folder `examples` provide Makefile and Segger Embedded Studio build support. +The stack is developed with GCC compiler, and should be compilable with others. Folder `examples` provide Makefile and Segger Embedded Studio build support. ## Getting Started diff --git a/examples/device/cdc_msc_hid/src/main.c b/examples/device/cdc_msc_hid/src/main.c index 1416852f7..53161fe83 100644 --- a/examples/device/cdc_msc_hid/src/main.c +++ b/examples/device/cdc_msc_hid/src/main.c @@ -34,6 +34,14 @@ //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF PROTYPES //--------------------------------------------------------------------+ + +/* Blink pattern + * - 250 ms : device not mounted + * - 1000 ms : device mounted + * - 2000 ms : device is suspended + */ +static uint32_t blink_interval_ms = 250; + void led_blinking_task(void); extern void virtual_com_task(void); @@ -187,18 +195,19 @@ void tud_hid_generic_set_report_cb(uint8_t report_id, hid_report_type_t report_t #endif //--------------------------------------------------------------------+ -// tinyusb callbacks +// Device callbacks //--------------------------------------------------------------------+ // Invoked when device is mounted void tud_mount_cb(void) { - + blink_interval_ms = 1000; } // Invoked when device is unmounted void tud_umount_cb(void) { + blink_interval_ms = 250; } //--------------------------------------------------------------------+ @@ -206,14 +215,12 @@ void tud_umount_cb(void) //--------------------------------------------------------------------+ void led_blinking_task(void) { - const uint32_t interval_ms = 1000; static uint32_t start_ms = 0; - static bool led_state = false; // Blink every 1000 ms - if ( board_millis() < start_ms + interval_ms) return; // not enough time - start_ms += interval_ms; + if ( board_millis() < start_ms + blink_interval_ms) return; // not enough time + start_ms += blink_interval_ms; board_led_control(led_state); led_state = 1 - led_state; // toggle diff --git a/src/device/usbd.h b/src/device/usbd.h index eb99337e3..1a4a21837 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -34,16 +34,9 @@ extern "C" {
#endif
-//--------------------------------------------------------------------+
-// INCLUDE
-//--------------------------------------------------------------------+
#include "common/tusb_common.h"
#include "device/dcd.h"
-//--------------------------------------------------------------------+
-// MACRO CONSTANT TYPEDEF
-//--------------------------------------------------------------------+
-
/// \brief Descriptor pointer collector to all the needed.
typedef struct {
void const * device; ///< pointer to device descriptor \ref tusb_desc_device_t
@@ -64,7 +57,7 @@ typedef struct { extern tud_desc_set_t tud_desc_set;
//--------------------------------------------------------------------+
-// APPLICATION API
+// Application API
//--------------------------------------------------------------------+
bool tud_mounted(void);
void tud_task (void);
@@ -72,7 +65,7 @@ void tud_task (void); bool tud_remote_wakeup(void);
//--------------------------------------------------------------------+
-// APPLICATION CALLBACK (WEAK is optional)
+// Application Callbacks (WEAK is optional)
//--------------------------------------------------------------------+
// Callback invoked when device is mounted (configured)
|
