mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
clean up
This commit is contained in:
parent
af3c301ea5
commit
00a9e492cd
@ -176,6 +176,8 @@ bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const
|
||||
{
|
||||
board_led_write(true);
|
||||
blink_interval_ms = BLINK_ALWAYS_ON;
|
||||
|
||||
tud_vendor_write_str("\r\nTinyUSB WebUSB device example\r\n");
|
||||
}else
|
||||
{
|
||||
blink_interval_ms = BLINK_MOUNTED;
|
||||
@ -247,7 +249,7 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
|
||||
if ( dtr && rts )
|
||||
{
|
||||
// print initial message when connected
|
||||
tud_cdc_write_str("\r\nTinyUSB CDC MSC HID device example\r\n");
|
||||
tud_cdc_write_str("\r\nTinyUSB WebUSB device example\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
2
src/class/vendor/vendor_device.c
vendored
2
src/class/vendor/vendor_device.c
vendored
@ -113,7 +113,7 @@ static bool maybe_transmit(vendord_interface_t* p_itf)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t tud_vendor_n_write (uint8_t itf, uint8_t const* buffer, uint32_t bufsize)
|
||||
uint32_t tud_vendor_n_write (uint8_t itf, void const* buffer, uint32_t bufsize)
|
||||
{
|
||||
vendord_interface_t* p_itf = &_vendord_itf[itf];
|
||||
uint16_t ret = tu_fifo_write_n(&p_itf->tx_ff, buffer, bufsize);
|
||||
|
19
src/class/vendor/vendor_device.h
vendored
19
src/class/vendor/vendor_device.h
vendored
@ -52,7 +52,9 @@
|
||||
bool tud_vendor_n_mounted (uint8_t itf);
|
||||
uint32_t tud_vendor_n_available (uint8_t itf);
|
||||
uint32_t tud_vendor_n_read (uint8_t itf, void* buffer, uint32_t bufsize);
|
||||
uint32_t tud_vendor_n_write (uint8_t itf, uint8_t const* buffer, uint32_t bufsize);
|
||||
uint32_t tud_vendor_n_write (uint8_t itf, void const* buffer, uint32_t bufsize);
|
||||
|
||||
static inline uint32_t tud_vendor_n_write_str (uint8_t itf, char const* str);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Application API (Single Port)
|
||||
@ -60,7 +62,8 @@ uint32_t tud_vendor_n_write (uint8_t itf, uint8_t const* buffer, uint32_t b
|
||||
static inline bool tud_vendor_mounted (void);
|
||||
static inline uint32_t tud_vendor_available (void);
|
||||
static inline uint32_t tud_vendor_read (void* buffer, uint32_t bufsize);
|
||||
static inline uint32_t tud_vendor_write (uint8_t const* buffer, uint32_t bufsize);
|
||||
static inline uint32_t tud_vendor_write (void const* buffer, uint32_t bufsize);
|
||||
static inline uint32_t tud_vendor_write_str (char const* str);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Application Callback API (weak is optional)
|
||||
@ -73,6 +76,11 @@ TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf);
|
||||
// Inline Functions
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
static inline uint32_t tud_vendor_n_write_str (uint8_t itf, char const* str)
|
||||
{
|
||||
return tud_vendor_n_write(itf, str, strlen(str));
|
||||
}
|
||||
|
||||
static inline bool tud_vendor_mounted (void)
|
||||
{
|
||||
return tud_vendor_n_mounted(0);
|
||||
@ -88,11 +96,16 @@ static inline uint32_t tud_vendor_read (void* buffer, uint32_t bufsize)
|
||||
return tud_vendor_n_read(0, buffer, bufsize);
|
||||
}
|
||||
|
||||
static inline uint32_t tud_vendor_write (uint8_t const* buffer, uint32_t bufsize)
|
||||
static inline uint32_t tud_vendor_write (void const* buffer, uint32_t bufsize)
|
||||
{
|
||||
return tud_vendor_n_write(0, buffer, bufsize);
|
||||
}
|
||||
|
||||
static inline uint32_t tud_vendor_write_str (char const* str)
|
||||
{
|
||||
return tud_vendor_n_write_str(0, str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Internal Class Driver API
|
||||
//--------------------------------------------------------------------+
|
||||
|
Loading…
x
Reference in New Issue
Block a user