mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #19006 from gschorcht/pkg/tinyusb_board_reset
pkg/tinyusb: add usb_board_reset support
This commit is contained in:
commit
0d64cc2fa5
@ -20,6 +20,8 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define USB_H_USER_IS_RIOT_INTERNAL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -32,6 +34,7 @@
|
||||
|
||||
#ifdef MODULE_USB_BOARD_RESET
|
||||
#include "usb_board_reset_internal.h"
|
||||
#include "class/cdc/cdc.h"
|
||||
#endif
|
||||
|
||||
static mutex_t data_lock = MUTEX_INIT_LOCKED;
|
||||
@ -78,3 +81,21 @@ void tud_cdc_rx_cb(uint8_t itf)
|
||||
|
||||
mutex_unlock(&data_lock);
|
||||
}
|
||||
|
||||
#ifdef MODULE_USB_BOARD_RESET
|
||||
|
||||
void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* p_line_coding)
|
||||
{
|
||||
(void)itf;
|
||||
assert(p_line_coding != NULL);
|
||||
|
||||
/* The first parameter is the USBUS CDC ACM device, but this is
|
||||
* not used in `usb_board_reset_coding_cb`. Therefore we can simply
|
||||
* reuse this callback function in tinyUSB without any problems. */
|
||||
usb_board_reset_coding_cb(NULL,
|
||||
p_line_coding->bit_rate,
|
||||
p_line_coding->data_bits,
|
||||
p_line_coding->parity,
|
||||
p_line_coding->stop_bits);
|
||||
}
|
||||
#endif
|
||||
|
@ -110,6 +110,7 @@ static inline bool osal_mutex_lock(osal_mutex_t mutex_hdl, uint32_t msec)
|
||||
|
||||
return mutex_lock_cancelable(&_mc) == 0;
|
||||
#else
|
||||
(void)msec;
|
||||
assert(msec == OSAL_TIMEOUT_WAIT_FOREVER);
|
||||
mutex_lock(mutex_hdl);
|
||||
return true;
|
||||
|
@ -23,6 +23,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define USB_H_USER_IS_RIOT_INTERNAL
|
||||
|
||||
#include "fmt.h"
|
||||
#include "luid.h"
|
||||
#include "tusb.h"
|
||||
|
@ -8,4 +8,4 @@
|
||||
config MODULE_USB_BOARD_RESET
|
||||
bool "Trigger a board reset via USB CDC ACM"
|
||||
depends on TEST_KCONFIG
|
||||
depends on MODULE_USBUS_CDC_ACM
|
||||
depends on MODULE_USBUS_CDC_ACM || MODULE_STDIO_TINYUSB_CDC_ACM
|
||||
|
@ -36,7 +36,12 @@ int usb_board_reset_coding_cb(usbus_cdcacm_device_t *cdcacm,
|
||||
uint32_t baud, uint8_t bits,
|
||||
uint8_t parity, uint8_t stop)
|
||||
{
|
||||
/* Note: This function is also used by tinyUSB if module `usb_board_reset`
|
||||
* is used. In this case no USBUS CDC ACM device is defined and parameter
|
||||
* `cdcacm` is NULL. Please keep this in mind if `cdcacm` is to be used
|
||||
* in future versions. */
|
||||
(void)cdcacm;
|
||||
|
||||
(void)bits;
|
||||
(void)parity;
|
||||
(void)stop;
|
||||
|
@ -1,5 +1,3 @@
|
||||
CONFIG_PACKAGE_TINYUSB=y
|
||||
CONFIG_MODULE_TINYUSB_CLASS_CDC=y
|
||||
CONFIG_MODULE_TINYUSB_CLASS_MSC=y
|
||||
CONFIG_MODULE_TINYUSB_COMMON=y
|
||||
CONFIG_MODULE_TINYUSB_DEVICE=y
|
||||
|
Loading…
Reference in New Issue
Block a user