Skip to content

Commit 34d0660

Browse files
committed
Review fixups
pico_usb_reset_... -> usb_reset_... PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB -> PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB Add to docs/index.h
1 parent ff769aa commit 34d0660

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

docs/index.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,6 @@
127127
* \cond boot_picoboot_headers \defgroup boot_picoboot_headers boot_picoboot_headers \endcond
128128
* \cond boot_uf2_headers \defgroup boot_uf2_headers boot_uf2_headers \endcond
129129
* \cond pico_usb_reset_interface_headers \defgroup pico_usb_reset_interface_headers pico_usb_reset_interface_headers \endcond
130+
* \cond pico_usb_reset_interface \defgroup pico_usb_reset_interface pico_usb_reset_interface \endcond
130131
* @}
131132
*/

src/common/pico_usb_reset_interface_headers/include/pico/usb_reset_interface_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
#endif
3535
#endif
3636

37-
// PICO_CONFIG: PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB, Set to 0 if your application defines usbd_app_driver_get_cb, type=bool, default=1 when using pico_usb_reset_interface, 0 otherwise, group=pico_usb_reset_interface
38-
#ifndef PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB
39-
#define PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB LIB_PICO_STDIO_USB
37+
// PICO_CONFIG: PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB, Set to 0 if your application defines its own usbd_app_driver_get_cb function, type=bool, default=1 when using pico_usb_reset_interface, 0 otherwise, group=pico_usb_reset_interface
38+
#ifndef PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB
39+
#define PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB LIB_PICO_STDIO_USB
4040
#endif
4141

4242
// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL, If vendor reset interface is included allow rebooting to BOOTSEL mode, type=bool, default=1, group=pico_usb_reset_interface
@@ -63,7 +63,7 @@
6363
#endif
6464
#endif
6565

66-
// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF, If vendor reset interface is included the USB interface number for the reset interface, type=int, default=2 if application is not using TinyUSB directly, undefined otherwise, group=pico_usb_reset_interface
66+
// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF, If vendor reset interface is included this specifies the USB interface number for the reset interface, type=int, default=2 if application is not using TinyUSB directly, undefined otherwise, group=pico_usb_reset_interface
6767
#ifndef PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF
6868
#if !LIB_TINYUSB_HOST && !LIB_TINYUSB_DEVICE
6969
#define PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF 2

src/common/pico_usb_reset_interface_headers/include/pico/usb_reset_interface_device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
* 2. Define PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE=1
2222
* 3. Add `TUD_RPI_RESET_DESCRIPTOR(<ITF_NUM>, <STR_IDX>)` to your USB descriptors (length is `TUD_RPI_RESET_DESC_LEN`)
2323
* 4. Check if your project has an existing `usbd_app_driver_get_cb` function:
24-
* - If it does, you need to add the `pico_usb_reset_interface_driver` to the drivers returned
25-
* - If it does not, and you aren't using the `pico_stdio_usb` library, you need to define `PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB=1`
24+
* - If it does, you need to add the `usb_reset_interface_driver` to the drivers returned
25+
* - If it does not, and you aren't using the `pico_stdio_usb` library, you need to define `PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB=1`
2626
* 5. Check if your project has an existing Microsoft OS 2.0 Descriptor:
2727
* - If it does, you need to add the Function Subset header `RPI_RESET_MS_OS_20_DESCRIPTOR(<ITF_NUM>)` to your Microsoft OS 2.0 Descriptor (length is `RPI_RESET_MS_OS_20_DESC_LEN`)
2828
* - If it does not, you need to define `PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR=1` and `PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF=<ITF_NUM>`

src/common/pico_usb_reset_interface_headers/include/pico/usb_reset_interface_tusb.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@
4242
#include "stdint.h"
4343
#include "device/usbd_pvt.h"
4444

45-
void pico_usb_reset_interface_init(void);
46-
void pico_usb_reset_interface_reset(uint8_t __unused rhport);
47-
uint16_t pico_usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len);
48-
bool pico_usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request);
49-
bool pico_usb_reset_interface_xfer_cb(uint8_t __unused rhport, uint8_t __unused ep_addr, xfer_result_t __unused result, uint32_t __unused xferred_bytes);
45+
void usb_reset_interface_init(void);
46+
void usb_reset_interface_reset(uint8_t __unused rhport);
47+
uint16_t usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len);
48+
bool usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request);
49+
bool usb_reset_interface_xfer_cb(uint8_t __unused rhport, uint8_t __unused ep_addr, xfer_result_t __unused result, uint32_t __unused xferred_bytes);
5050

51-
static usbd_class_driver_t const pico_usb_reset_interface_driver =
51+
static usbd_class_driver_t const usb_reset_interface_driver =
5252
{
5353
#if CFG_TUSB_DEBUG >= 2
5454
.name = "RESET",
5555
#endif
56-
.init = pico_usb_reset_interface_init,
57-
.reset = pico_usb_reset_interface_reset,
58-
.open = pico_usb_reset_interface_open,
59-
.control_xfer_cb = pico_usb_reset_interface_control_xfer_cb,
60-
.xfer_cb = pico_usb_reset_interface_xfer_cb,
56+
.init = usb_reset_interface_init,
57+
.reset = usb_reset_interface_reset,
58+
.open = usb_reset_interface_open,
59+
.control_xfer_cb = usb_reset_interface_control_xfer_cb,
60+
.xfer_cb = usb_reset_interface_xfer_cb,
6161
.sof = NULL
6262
};
6363

src/rp2_common/pico_usb_reset_interface/usb_reset_interface.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
6868
}
6969
#endif
7070

71-
void pico_usb_reset_interface_init(void) {
71+
void usb_reset_interface_init(void) {
7272
}
7373

74-
void pico_usb_reset_interface_reset(uint8_t __unused rhport) {
74+
void usb_reset_interface_reset(uint8_t __unused rhport) {
7575
itf_num = 0;
7676
}
7777

78-
uint16_t pico_usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len) {
78+
uint16_t usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len) {
7979
TU_VERIFY(TUSB_CLASS_VENDOR_SPECIFIC == itf_desc->bInterfaceClass &&
8080
RESET_INTERFACE_SUBCLASS == itf_desc->bInterfaceSubClass &&
8181
RESET_INTERFACE_PROTOCOL == itf_desc->bInterfaceProtocol, 0);
@@ -88,7 +88,7 @@ uint16_t pico_usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interf
8888
}
8989

9090
// Support for parameterized reset via vendor interface control request
91-
bool pico_usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request) {
91+
bool usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request) {
9292
// nothing to do with DATA & ACK stage
9393
if (stage != CONTROL_STAGE_SETUP) return true;
9494

@@ -125,15 +125,15 @@ bool pico_usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t s
125125
return false;
126126
}
127127

128-
bool pico_usb_reset_interface_xfer_cb(uint8_t __unused rhport, uint8_t __unused ep_addr, xfer_result_t __unused result, uint32_t __unused xferred_bytes) {
128+
bool usb_reset_interface_xfer_cb(uint8_t __unused rhport, uint8_t __unused ep_addr, xfer_result_t __unused result, uint32_t __unused xferred_bytes) {
129129
return true;
130130
}
131131

132-
#if PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB
132+
#if PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB
133133
// Implement callback to add our custom driver
134134
usbd_class_driver_t const *usbd_app_driver_get_cb(uint8_t *driver_count) {
135135
*driver_count = 1;
136-
return &pico_usb_reset_interface_driver;
136+
return &usb_reset_interface_driver;
137137
}
138138
#endif
139139
#endif

0 commit comments

Comments
 (0)