diff options
| author | hathach <[email protected]> | 2014-03-31 12:06:13 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2014-03-31 12:06:13 +0700 |
| commit | bc99f596993206680f6825263e124d5497c358e0 (patch) | |
| tree | da09b2ad0dd758744884b933b094609714ad10b7 | |
| parent | 6682720b2aecb777d8f8aceedbd49aaff4fbbc27 (diff) | |
code beautify
| -rw-r--r-- | demos/device/src/cdc_device_app.c | 2 | ||||
| -rw-r--r-- | demos/device/src/keyboard_device_app.c | 2 | ||||
| -rw-r--r-- | demos/device/src/mouse_device_app.c | 2 | ||||
| -rw-r--r-- | demos/device/src/msc_device_app.c | 8 | ||||
| -rw-r--r-- | demos/host/src/cdc_serial_host_app.c | 3 | ||||
| -rw-r--r-- | demos/host/src/keyboard_host_app.c | 10 | ||||
| -rw-r--r-- | demos/host/src/mouse_host_app.c | 5 | ||||
| -rw-r--r-- | demos/host/src/msc_host_app.c | 5 |
8 files changed, 18 insertions, 19 deletions
diff --git a/demos/device/src/cdc_device_app.c b/demos/device/src/cdc_device_app.c index 572db4b0c..2abbc427b 100644 --- a/demos/device/src/cdc_device_app.c +++ b/demos/device/src/cdc_device_app.c @@ -67,7 +67,7 @@ TUSB_CFG_ATTR_USBRAM static uint8_t serial_tx_buffer[CDCD_APP_BUFFER_SIZE]; FIFO_DEF(fifo_serial, CDCD_APP_BUFFER_SIZE, uint8_t, true);
//--------------------------------------------------------------------+
-// tinyusb Callbacks
+// tinyusb callbacks
//--------------------------------------------------------------------+
void tusbd_cdc_mounted_cb(uint8_t coreid)
{
diff --git a/demos/device/src/keyboard_device_app.c b/demos/device/src/keyboard_device_app.c index c3096a247..4cbb3b1aa 100644 --- a/demos/device/src/keyboard_device_app.c +++ b/demos/device/src/keyboard_device_app.c @@ -56,7 +56,7 @@ OSAL_TASK_DEF(keyboard_device_app_task, 128, KEYBOARD_APP_TASK_PRIO); TUSB_CFG_ATTR_USBRAM hid_keyboard_report_t keyboard_report;
//--------------------------------------------------------------------+
-// tinyusb Callbacks
+// tinyusb callbacks
//--------------------------------------------------------------------+
void tusbd_hid_keyboard_mounted_cb(uint8_t coreid)
{
diff --git a/demos/device/src/mouse_device_app.c b/demos/device/src/mouse_device_app.c index f38e4f062..360cb8787 100644 --- a/demos/device/src/mouse_device_app.c +++ b/demos/device/src/mouse_device_app.c @@ -56,7 +56,7 @@ OSAL_TASK_DEF(mouse_device_app_task, 128, MOUSE_APP_TASK_PRIO); TUSB_CFG_ATTR_USBRAM hid_mouse_report_t mouse_report;
//--------------------------------------------------------------------+
-// tinyusb Callbacks
+// tinyusb callbacks
//--------------------------------------------------------------------+
void tusbd_hid_mouse_mounted_cb(uint8_t coreid)
{
diff --git a/demos/device/src/msc_device_app.c b/demos/device/src/msc_device_app.c index cc4063c80..e1b91295c 100644 --- a/demos/device/src/msc_device_app.c +++ b/demos/device/src/msc_device_app.c @@ -87,11 +87,7 @@ static scsi_mode_parameters_t const msc_dev_mode_para = };
//--------------------------------------------------------------------+
-// INTERNAL OBJECT & FUNCTION DECLARATION
-//--------------------------------------------------------------------+
-
-//--------------------------------------------------------------------+
-// tinyusb callback (ISR context)
+// tinyusb callbacks
//--------------------------------------------------------------------+
void tusbd_msc_mounted_cb(uint8_t coreid)
{
@@ -158,7 +154,7 @@ msc_csw_status_t tusbd_msc_scsi_cb (uint8_t coreid, uint8_t lun, uint8_t scsi_cm }
//--------------------------------------------------------------------+
-// IMPLEMENTATION
+// APPLICATION CODE
//--------------------------------------------------------------------+
OSAL_TASK_FUNCTION( msc_device_app_task , p_task_para)
{ // no need to implement the task yet
diff --git a/demos/host/src/cdc_serial_host_app.c b/demos/host/src/cdc_serial_host_app.c index cf3b0c09d..0176feb5f 100644 --- a/demos/host/src/cdc_serial_host_app.c +++ b/demos/host/src/cdc_serial_host_app.c @@ -57,7 +57,7 @@ TUSB_CFG_ATTR_USBRAM static uint8_t serial_out_buffer[32]; static uint8_t received_bytes; // set by transfer complete callback
//--------------------------------------------------------------------+
-// tinyusb Callbacks
+// tinyusb callbacks
//--------------------------------------------------------------------+
void tusbh_cdc_mounted_cb(uint8_t dev_addr)
{ // application set-up
@@ -76,6 +76,7 @@ void tusbh_cdc_unmounted_cb(uint8_t dev_addr) printf("\na CDC device (address %d) is unmounted \n", dev_addr);
}
+// invoked ISR context
void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes)
{
(void) dev_addr; // compiler warnings
diff --git a/demos/host/src/keyboard_host_app.c b/demos/host/src/keyboard_host_app.c index 2a0424d65..2ba0296c0 100644 --- a/demos/host/src/keyboard_host_app.c +++ b/demos/host/src/keyboard_host_app.c @@ -62,7 +62,7 @@ static inline uint8_t keycode_to_ascii(uint8_t modifier, uint8_t keycode) ATTR_C static inline void process_kbd_report(hid_keyboard_report_t const * report);
//--------------------------------------------------------------------+
-// tinyusb callback (ISR context)
+// tinyusb callbacks
//--------------------------------------------------------------------+
void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr)
{
@@ -79,6 +79,7 @@ void tusbh_hid_keyboard_unmounted_cb(uint8_t dev_addr) printf("\na Keyboard device (address %d) is unmounted\n", dev_addr);
}
+// invoked ISR context
void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event)
{
switch(event)
@@ -132,9 +133,8 @@ OSAL_TASK_FUNCTION( keyboard_host_app_task, p_task_para) //--------------------------------------------------------------------+
// HELPER
//--------------------------------------------------------------------+
-
// look up new key in previous keys
-static inline bool is_key_in_report(hid_keyboard_report_t const *p_report, uint8_t keycode)
+static inline bool find_key_in_report(hid_keyboard_report_t const *p_report, uint8_t keycode)
{
for(uint8_t i=0; i<6; i++)
{
@@ -153,12 +153,12 @@ static inline void process_kbd_report(hid_keyboard_report_t const *p_new_report) {
if ( p_new_report->keycode[i] )
{
- if ( is_key_in_report(&prev_report, p_new_report->keycode[i]) )
+ if ( find_key_in_report(&prev_report, p_new_report->keycode[i]) )
{
// exist in previous report means the current key is holding
}else
{
- // not exist in previous report means the current key is pressed
+ // not existed in previous report means the current key is pressed
uint8_t ch = keycode_to_ascii(p_new_report->modifier, p_new_report->keycode[i]);
putchar(ch);
if ( ch == '\r' ) putchar('\n'); // added new line for enter key
diff --git a/demos/host/src/mouse_host_app.c b/demos/host/src/mouse_host_app.c index 3ad785094..1c811b62c 100644 --- a/demos/host/src/mouse_host_app.c +++ b/demos/host/src/mouse_host_app.c @@ -61,7 +61,7 @@ TUSB_CFG_ATTR_USBRAM static hid_mouse_report_t usb_mouse_report; static inline void process_mouse_report(hid_mouse_report_t const * p_report);
//--------------------------------------------------------------------+
-// tinyusb callback (ISR context)
+// tinyusb callbacks
//--------------------------------------------------------------------+
void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr)
{
@@ -78,6 +78,7 @@ void tusbh_hid_mouse_unmounted_cb(uint8_t dev_addr) printf("\na Mouse device (address %d) is unmounted\n", dev_addr);
}
+// invoked ISR context
void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event)
{
switch(event)
@@ -97,7 +98,7 @@ void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event) }
//--------------------------------------------------------------------+
-// APPLICATION
+// APPLICATION CODE
// NOTICE: MOUSE REPORT IS NOT CORRECT UNTIL A DECENT HID PARSER IS
// IMPLEMENTED, MEANWHILE IT CAN MISS DISPLAY BUTTONS OR X,Y etc
//--------------------------------------------------------------------+
diff --git a/demos/host/src/msc_host_app.c b/demos/host/src/msc_host_app.c index 5c1cce4e9..62d3b0a35 100644 --- a/demos/host/src/msc_host_app.c +++ b/demos/host/src/msc_host_app.c @@ -60,7 +60,7 @@ OSAL_TASK_DEF(msc_host_app_task, 512, MSC_APP_TASK_PRIO); TUSB_CFG_ATTR_USBRAM static FATFS fatfs[TUSB_CFG_HOST_DEVICE_MAX];
//--------------------------------------------------------------------+
-// tinyusb callback (ISR context)
+// tinyusb callbacks
//--------------------------------------------------------------------+
void tusbh_msc_mounted_cb(uint8_t dev_addr)
{
@@ -130,6 +130,7 @@ void tusbh_msc_unmounted_cb(uint8_t dev_addr) }
}
+// invoked ISR context
void tusbh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes)
{
(void) dev_addr;
@@ -138,7 +139,7 @@ void tusbh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes) }
//--------------------------------------------------------------------+
-// IMPLEMENTATION
+// APPLICATION CODE
//--------------------------------------------------------------------+
void msc_host_app_init(void)
{
|
