mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 05:42:56 +00:00
clean up example
This commit is contained in:
parent
078f600055
commit
f5260610d3
@ -96,14 +96,14 @@ tusb_error_t cdc_serial_subtask(void)
|
|||||||
{
|
{
|
||||||
OSAL_SUBTASK_BEGIN
|
OSAL_SUBTASK_BEGIN
|
||||||
|
|
||||||
if ( tud_mounted(0) && tud_cdc_available(0) )
|
if ( tud_mounted() && tud_cdc_available() )
|
||||||
{
|
{
|
||||||
uint8_t buf[64];
|
uint8_t buf[64];
|
||||||
|
|
||||||
// read and echo back
|
// read and echo back
|
||||||
uint32_t count = tud_cdc_read(0, buf, sizeof(buf));
|
uint32_t count = tud_cdc_read(buf, sizeof(buf));
|
||||||
|
|
||||||
tud_cdc_write(0, buf, count);
|
tud_cdc_write(buf, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSAL_SUBTASK_END
|
OSAL_SUBTASK_END
|
||||||
|
@ -128,7 +128,7 @@ tusb_error_t keyboard_device_subtask(void)
|
|||||||
|
|
||||||
osal_task_delay(50);
|
osal_task_delay(50);
|
||||||
|
|
||||||
if ( tud_mounted(0) && !tud_hid_keyboard_busy(0) )
|
if ( tud_mounted() && !tud_hid_keyboard_busy(0) )
|
||||||
{
|
{
|
||||||
static uint32_t button_mask = 0;
|
static uint32_t button_mask = 0;
|
||||||
uint32_t new_button_mask = board_buttons();
|
uint32_t new_button_mask = board_buttons();
|
||||||
|
@ -114,7 +114,7 @@ void mouse_app_subtask(void)
|
|||||||
|
|
||||||
osal_task_delay(20);
|
osal_task_delay(20);
|
||||||
|
|
||||||
if ( tud_mounted(0) && !tud_hid_mouse_is_busy(0) )
|
if ( tud_mounted() && !tud_hid_mouse_is_busy(0) )
|
||||||
{
|
{
|
||||||
static uint8_t prev_mouse_buttons = 0;
|
static uint8_t prev_mouse_buttons = 0;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ bool tud_hid_keyboard_busy(uint8_t port)
|
|||||||
|
|
||||||
tusb_error_t tud_hid_keyboard_send(uint8_t port, hid_keyboard_report_t const *p_report)
|
tusb_error_t tud_hid_keyboard_send(uint8_t port, hid_keyboard_report_t const *p_report)
|
||||||
{
|
{
|
||||||
ASSERT(tud_mounted(port), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED);
|
ASSERT(tud_mounted(), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED);
|
||||||
|
|
||||||
hidd_interface_t * p_kbd = &keyboardd_data; // TODO &keyboardd_data[port];
|
hidd_interface_t * p_kbd = &keyboardd_data; // TODO &keyboardd_data[port];
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ bool tud_hid_mouse_is_busy(uint8_t port)
|
|||||||
|
|
||||||
tusb_error_t tud_hid_mouse_send(uint8_t port, hid_mouse_report_t const *p_report)
|
tusb_error_t tud_hid_mouse_send(uint8_t port, hid_mouse_report_t const *p_report)
|
||||||
{
|
{
|
||||||
ASSERT(tud_mounted(port), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED);
|
ASSERT(tud_mounted(), TUSB_ERROR_USBD_DEVICE_NOT_CONFIGURED);
|
||||||
|
|
||||||
hidd_interface_t * p_mouse = &moused_data; // TODO &keyboardd_data[port];
|
hidd_interface_t * p_mouse = &moused_data; // TODO &keyboardd_data[port];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user