1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/tinyusb: board reset feature moved

The board reset function can be used on any CDC ACM interface. It is not necessary that the tinyUSB CDC ACM STDIO is used. Therefore, the board reset function is now a feature of the CDC ACM interface that don't require any other functionality.
This commit is contained in:
Gunar Schorcht 2022-12-10 18:54:47 +01:00
parent 0fbe9f6dfd
commit c0d027156a
3 changed files with 32 additions and 24 deletions

View File

@ -32,11 +32,6 @@
#include "vfs.h"
#endif
#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;
void stdio_init(void)
@ -81,21 +76,3 @@ 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

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2022 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
#if MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_CDC && MODULE_USB_BOARD_RESET
#include "usb_board_reset_internal.h"
#include "class/cdc/cdc.h"
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);
}
#else
typedef int dont_be_pedantic;
#endif

View File

@ -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 || MODULE_STDIO_TINYUSB_CDC_ACM
depends on MODULE_USBUS_CDC_ACM || (MODULE_TINYUSB_DEVICE && MODULE_TINYUSB_CLASS_CDC)