fix some warnings
This commit is contained in:
@@ -86,16 +86,15 @@ void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_
|
||||
case TUSB_EVENT_XFER_COMPLETE:
|
||||
received_bytes = xferred_bytes;
|
||||
osal_semaphore_post(sem_hdl); // notify main task
|
||||
break;
|
||||
break;
|
||||
|
||||
case TUSB_EVENT_XFER_ERROR:
|
||||
received_bytes = 0; // ignore
|
||||
break;
|
||||
break;
|
||||
|
||||
case TUSB_EVENT_XFER_STALLED:
|
||||
default :
|
||||
ASSERT(false, VOID_RETURN);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ static char const * const cli_error_message[] =
|
||||
#define CLI_PROTOTYPE_EXPAND(command, function, description) \
|
||||
cli_error_t function(char * p_para);
|
||||
|
||||
CLI_COMMAND_TABLE(CLI_PROTOTYPE_EXPAND);
|
||||
CLI_COMMAND_TABLE(CLI_PROTOTYPE_EXPAND)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Expand to enum value
|
||||
|
||||
@@ -133,14 +133,11 @@ OSAL_TASK_FUNCTION( keyboard_app_task ) (void* p_task_para)
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// look up new key in previous keys
|
||||
static inline bool is_key_in_report(hid_keyboard_report_t const *p_report, uint8_t modifier, uint8_t keycode)
|
||||
static inline bool is_key_in_report(hid_keyboard_report_t const *p_report, uint8_t keycode)
|
||||
{
|
||||
for(uint8_t i=0; i<6; i++)
|
||||
{
|
||||
if (p_report->keycode[i] == keycode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (p_report->keycode[i] == keycode) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -148,19 +145,19 @@ static inline bool is_key_in_report(hid_keyboard_report_t const *p_report, uint8
|
||||
|
||||
static inline void process_kbd_report(hid_keyboard_report_t const *p_new_report)
|
||||
{
|
||||
static hid_keyboard_report_t prev_report = { 0 }; // previous report to check key released
|
||||
static hid_keyboard_report_t prev_report = { 0, 0, {0} }; // previous report to check key released
|
||||
|
||||
//------------- example code ignore control (non-printable) key affects -------------//
|
||||
for(uint8_t i=0; i<6; i++)
|
||||
{
|
||||
if ( p_new_report->keycode[i] )
|
||||
{
|
||||
if ( is_key_in_report(&prev_report, p_new_report->modifier, p_new_report->keycode[i]) )
|
||||
if ( is_key_in_report(&prev_report, p_new_report->keycode[i]) )
|
||||
{
|
||||
// previously existed means holding
|
||||
// exist in previous report means the current key is holding
|
||||
}else
|
||||
{
|
||||
// previously non-existed means key is pressed
|
||||
// not exist 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
|
||||
|
||||
@@ -109,7 +109,6 @@ void os_none_start_scheduler(void)
|
||||
msc_app_task(NULL);
|
||||
cdc_serial_app_task(NULL);
|
||||
rndis_app_task(NULL);
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -144,8 +143,6 @@ int main(void)
|
||||
#error need to start RTOS schduler
|
||||
#endif
|
||||
|
||||
while(1) { } // should not be reached here
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,8 @@ OSAL_TASK_FUNCTION( mouse_app_task ) (void* p_task_para)
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
|
||||
osal_queue_receive(queue_mouse_hdl, &mouse_report, OSAL_TIMEOUT_WAIT_FOREVER, &error);
|
||||
(void) error; // supporess compiler's warninig
|
||||
|
||||
process_mouse_report(&mouse_report);
|
||||
|
||||
OSAL_TASK_LOOP_END
|
||||
@@ -162,7 +164,7 @@ void cursor_movement(int8_t x, int8_t y, int8_t wheel)
|
||||
|
||||
static inline void process_mouse_report(hid_mouse_report_t const * p_report)
|
||||
{
|
||||
static hid_mouse_report_t prev_report = { 0 };
|
||||
static hid_mouse_report_t prev_report = { 0, 0, 0, 0 };
|
||||
|
||||
//------------- button state -------------//
|
||||
uint8_t button_changed_mask = p_report->buttons ^ prev_report.buttons;
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
#define TUSB_CFG_HOST_HID_KEYBOARD 1
|
||||
#define TUSB_CFG_HOST_HID_MOUSE 1
|
||||
#define TUSB_CFG_HOST_HID_GENERIC 0
|
||||
#define TUSB_CFG_HOST_MSC 0
|
||||
#define TUSB_CFG_HOST_MSC 1
|
||||
#define TUSB_CFG_HOST_CDC 1
|
||||
#define TUSB_CFG_HOST_CDC_RNDIS 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user