mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-29 01:20:19 +00:00
fix some warnings
This commit is contained in:
parent
8fbafc460c
commit
f1692c93ac
@ -45,7 +45,7 @@
|
|||||||
#define BOARD_UART_PIN_TX 10 // PF.10 : UART0_TXD
|
#define BOARD_UART_PIN_TX 10 // PF.10 : UART0_TXD
|
||||||
#define BOARD_UART_PIN_RX 11 // PF.11 : UART0_RXD
|
#define BOARD_UART_PIN_RX 11 // PF.11 : UART0_RXD
|
||||||
|
|
||||||
const static struct {
|
static const struct {
|
||||||
uint8_t mux_port;
|
uint8_t mux_port;
|
||||||
uint8_t mux_pin;
|
uint8_t mux_pin;
|
||||||
|
|
||||||
|
@ -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:
|
case TUSB_EVENT_XFER_COMPLETE:
|
||||||
received_bytes = xferred_bytes;
|
received_bytes = xferred_bytes;
|
||||||
osal_semaphore_post(sem_hdl); // notify main task
|
osal_semaphore_post(sem_hdl); // notify main task
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TUSB_EVENT_XFER_ERROR:
|
case TUSB_EVENT_XFER_ERROR:
|
||||||
received_bytes = 0; // ignore
|
received_bytes = 0; // ignore
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TUSB_EVENT_XFER_STALLED:
|
case TUSB_EVENT_XFER_STALLED:
|
||||||
default :
|
default :
|
||||||
ASSERT(false, VOID_RETURN);
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ static char const * const cli_error_message[] =
|
|||||||
#define CLI_PROTOTYPE_EXPAND(command, function, description) \
|
#define CLI_PROTOTYPE_EXPAND(command, function, description) \
|
||||||
cli_error_t function(char * p_para);
|
cli_error_t function(char * p_para);
|
||||||
|
|
||||||
CLI_COMMAND_TABLE(CLI_PROTOTYPE_EXPAND);
|
CLI_COMMAND_TABLE(CLI_PROTOTYPE_EXPAND)
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Expand to enum value
|
// 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
|
// 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++)
|
for(uint8_t i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
if (p_report->keycode[i] == keycode)
|
if (p_report->keycode[i] == keycode) return true;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
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 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 -------------//
|
//------------- example code ignore control (non-printable) key affects -------------//
|
||||||
for(uint8_t i=0; i<6; i++)
|
for(uint8_t i=0; i<6; i++)
|
||||||
{
|
{
|
||||||
if ( p_new_report->keycode[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
|
}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]);
|
uint8_t ch = keycode_to_ascii(p_new_report->modifier, p_new_report->keycode[i]);
|
||||||
putchar(ch);
|
putchar(ch);
|
||||||
if ( ch == '\r' ) putchar('\n'); // added new line for enter key
|
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);
|
msc_app_task(NULL);
|
||||||
cdc_serial_app_task(NULL);
|
cdc_serial_app_task(NULL);
|
||||||
rndis_app_task(NULL);
|
rndis_app_task(NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -144,8 +143,6 @@ int main(void)
|
|||||||
#error need to start RTOS schduler
|
#error need to start RTOS schduler
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while(1) { } // should not be reached here
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +122,8 @@ OSAL_TASK_FUNCTION( mouse_app_task ) (void* p_task_para)
|
|||||||
OSAL_TASK_LOOP_BEGIN
|
OSAL_TASK_LOOP_BEGIN
|
||||||
|
|
||||||
osal_queue_receive(queue_mouse_hdl, &mouse_report, OSAL_TIMEOUT_WAIT_FOREVER, &error);
|
osal_queue_receive(queue_mouse_hdl, &mouse_report, OSAL_TIMEOUT_WAIT_FOREVER, &error);
|
||||||
|
(void) error; // supporess compiler's warninig
|
||||||
|
|
||||||
process_mouse_report(&mouse_report);
|
process_mouse_report(&mouse_report);
|
||||||
|
|
||||||
OSAL_TASK_LOOP_END
|
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 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 -------------//
|
//------------- button state -------------//
|
||||||
uint8_t button_changed_mask = p_report->buttons ^ prev_report.buttons;
|
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_KEYBOARD 1
|
||||||
#define TUSB_CFG_HOST_HID_MOUSE 1
|
#define TUSB_CFG_HOST_HID_MOUSE 1
|
||||||
#define TUSB_CFG_HOST_HID_GENERIC 0
|
#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 1
|
||||||
#define TUSB_CFG_HOST_CDC_RNDIS 0
|
#define TUSB_CFG_HOST_CDC_RNDIS 0
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
|
|||||||
SUBTASK_ASSERT_STATUS(error);
|
SUBTASK_ASSERT_STATUS(error);
|
||||||
|
|
||||||
//------------- SCSI Request Sense -------------//
|
//------------- SCSI Request Sense -------------//
|
||||||
tusbh_msc_request_sense(dev_addr, 0, msch_buffer);
|
(void) tusbh_msc_request_sense(dev_addr, 0, msch_buffer);
|
||||||
osal_semaphore_wait(msch_sem_hdl, SCSI_XFER_TIMEOUT, &error);
|
osal_semaphore_wait(msch_sem_hdl, SCSI_XFER_TIMEOUT, &error);
|
||||||
SUBTASK_ASSERT_STATUS(error);
|
SUBTASK_ASSERT_STATUS(error);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ static ehci_link_t* list_find_previous_item(ehci_link_t* p_head, ehci_link_t* p
|
|||||||
static tusb_error_t list_remove_qhd(ehci_link_t* p_head, ehci_link_t* p_remove);
|
static tusb_error_t list_remove_qhd(ehci_link_t* p_head, ehci_link_t* p_remove);
|
||||||
|
|
||||||
static tusb_error_t hcd_controller_init(uint8_t hostid) ATTR_WARN_UNUSED_RESULT;
|
static tusb_error_t hcd_controller_init(uint8_t hostid) ATTR_WARN_UNUSED_RESULT;
|
||||||
static tusb_error_t hcd_controller_stop(uint8_t hostid) ATTR_WARN_UNUSED_RESULT;
|
static tusb_error_t hcd_controller_stop(uint8_t hostid) ATTR_WARN_UNUSED_RESULT ATTR_UNUSED;
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// USBH-HCD API
|
// USBH-HCD API
|
||||||
@ -278,20 +278,6 @@ static tusb_error_t hcd_controller_stop(uint8_t hostid)
|
|||||||
return timeout_expired(&timeout) ? TUSB_ERROR_OSAL_TIMEOUT : TUSB_ERROR_NONE;
|
return timeout_expired(&timeout) ? TUSB_ERROR_OSAL_TIMEOUT : TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//tusb_error_t hcd_controller_reset(uint8_t hostid)
|
|
||||||
//{
|
|
||||||
// ehci_registers_t* const regs = get_operational_register(hostid);
|
|
||||||
// timeout_timer_t timeout;
|
|
||||||
//
|
|
||||||
//// NXP chip powered with non-host mode --> sts bit is not correctly reflected
|
|
||||||
// regs->usb_cmd_bit.reset = 1;
|
|
||||||
//
|
|
||||||
// timeout_set(&timeout, 2); // should not take longer the time to stop controller
|
|
||||||
// while( regs->usb_cmd_bit.reset && !timeout_expired(&timeout)) {}
|
|
||||||
//
|
|
||||||
// return timeout_expired(&timeout) ? TUSB_ERROR_OSAL_TIMEOUT : TUSB_ERROR_NONE;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// CONTROL PIPE API
|
// CONTROL PIPE API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -200,7 +200,6 @@ tusb_error_t hub_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t cons
|
|||||||
void hub_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes);
|
void hub_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes);
|
||||||
void hub_close(uint8_t dev_addr);
|
void hub_close(uint8_t dev_addr);
|
||||||
|
|
||||||
tusb_error_t hub_status_pipe_queue(uint8_t dev_addr);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -36,12 +36,6 @@
|
|||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
/** \file
|
|
||||||
* \brief TBD
|
|
||||||
*
|
|
||||||
* \note TBD
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** \ingroup TBD
|
/** \ingroup TBD
|
||||||
* \defgroup TBD
|
* \defgroup TBD
|
||||||
* \brief TBD
|
* \brief TBD
|
||||||
|
Loading…
x
Reference in New Issue
Block a user