Skip to content

Commit ff769aa

Browse files
committed
Make new usb_reset_interface_device header so old usb_reset_interface header remains the same
1 parent e3c11e1 commit ff769aa

File tree

5 files changed

+40
-29
lines changed

5 files changed

+40
-29
lines changed

src/common/pico_usb_reset_interface_headers/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ package(default_visibility = ["//visibility:public"])
22

33
cc_library(
44
name = "pico_usb_reset_interface_headers",
5-
hdrs = ["include/pico/usb_reset_interface.h", "include/pico/usb_reset_interface_config.h", "include/pico/usb_reset_interface_tusb.h"],
5+
hdrs = ["include/pico/usb_reset_interface.h", "include/pico/usb_reset_interface_config.h", "include/pico/usb_reset_interface_device.h", "include/pico/usb_reset_interface_tusb.h"],
66
includes = ["include"],
77
)

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

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,11 @@
88
#define _PICO_USB_RESET_INTERFACE_H
99

1010
/** \file usb_reset_interface.h
11-
* \defgroup pico_usb_reset_interface pico_usb_reset_interface
11+
* \defgroup pico_usb_reset_interface_headers pico_usb_reset_interface_headers
1212
*
13-
* \brief Functionality to enable the RP-series microcontroller to be reset over the USB interface.
14-
*
15-
* This library can be used to enable the RP-series microcontroller to be reset over the USB interface.
16-
*
17-
* This functionality is included by default when using the `pico_stdio_usb` library and not using TinyUSB directly.
18-
*
19-
* To add this functionality to a project using TinyUSB directly, you need to:
20-
* 1. Link the pico_usb_reset_interface library, and include the `pico/usb_reset_interface.h` header file where needed.
21-
* 2. Define PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE=1
22-
* 3. Add `TUD_RPI_RESET_DESCRIPTOR(<ITF_NUM>, <STR_IDX>)` to your USB descriptors (length is `TUD_RPI_RESET_DESC_LEN`)
23-
* 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`
26-
* 5. Check if your project has an existing Microsoft OS 2.0 Descriptor:
27-
* - 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`)
28-
* - 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>`
13+
* \brief Definition for the reset interface that may be exposed by the pico_stdio_usb library
2914
*/
3015

31-
// These defines are used by picotool
3216
// VENDOR sub-class for the reset interface
3317
#define RESET_INTERFACE_SUBCLASS 0x00
3418
// VENDOR protocol for the reset interface
@@ -41,12 +25,4 @@
4125
// regular flash boot
4226
#define RESET_REQUEST_FLASH 0x02
4327

44-
#if LIB_PICO_USB_RESET_INTERFACE
45-
// These defines are only used by the pico_usb_reset_interface library, not the pico_usb_reset_interface_headers library
46-
47-
#include "pico/usb_reset_interface_config.h"
48-
#include "pico/usb_reset_interface_tusb.h"
49-
50-
#endif
51-
5228
#endif
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2025 Raspberry Pi (Trading) Ltd.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#ifndef _PICO_USB_RESET_INTERFACE_DEVICE_H
8+
#define _PICO_USB_RESET_INTERFACE_DEVICE_H
9+
10+
/** \file usb_reset_interface_device.h
11+
* \defgroup pico_usb_reset_interface pico_usb_reset_interface
12+
*
13+
* \brief Functionality to enable the RP-series microcontroller to be reset over the USB interface.
14+
*
15+
* This library can be used to enable the RP-series microcontroller to be reset over the USB interface.
16+
*
17+
* This functionality is included by default when using the `pico_stdio_usb` library and not using TinyUSB directly.
18+
*
19+
* To add this functionality to a project using TinyUSB directly, you need to:
20+
* 1. Link the pico_usb_reset_interface library, and include the `pico/usb_reset_interface_device.h` header file where needed.
21+
* 2. Define PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE=1
22+
* 3. Add `TUD_RPI_RESET_DESCRIPTOR(<ITF_NUM>, <STR_IDX>)` to your USB descriptors (length is `TUD_RPI_RESET_DESC_LEN`)
23+
* 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`
26+
* 5. Check if your project has an existing Microsoft OS 2.0 Descriptor:
27+
* - 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`)
28+
* - 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>`
29+
*/
30+
31+
#include "pico/usb_reset_interface.h"
32+
#include "pico/usb_reset_interface_config.h"
33+
#include "pico/usb_reset_interface_tusb.h"
34+
35+
#endif

src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828

2929
#include "pico/stdio_usb.h"
30-
#include "pico/usb_reset_interface.h"
30+
#include "pico/usb_reset_interface_device.h"
3131
#include "pico/unique_id.h"
3232
#include "tusb.h"
3333

src/rp2_common/pico_usb_reset_interface/usb_reset_interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "tusb.h"
77

88
#include "pico/bootrom.h"
9-
#include "pico/usb_reset_interface.h"
9+
#include "pico/usb_reset_interface_device.h"
1010

1111
#if !defined(LIB_TINYUSB_HOST)
1212

0 commit comments

Comments
 (0)