summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-03-29 17:42:10 +0700
committerhathach <[email protected]>2019-03-29 17:42:10 +0700
commit28610198dfe70e98d3c2dcadb229f5ff12e2faf1 (patch)
tree31f01b138af80cc826f02402dd32792622076716
parent7d9b68a7b9e120e3f5b1fe23096c3c620558b87a (diff)
clean up
-rw-r--r--README.md6
-rw-r--r--examples/device/cdc_msc_hid/src/main.c19
-rw-r--r--src/device/usbd.h11
3 files changed, 18 insertions, 18 deletions
diff --git a/README.md b/README.md
index 635312eb1..888e73f5a 100644
--- a/README.md
+++ b/README.md
@@ -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)