Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/rp2_common/pico_stdio_usb/include/pico/stdio_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
#define PICO_STDIO_USB_SUPPORT_CHARS_AVAILABLE_CALLBACK 1
#endif

// PICO_CONFIG: PICO_STDIO_USB_BACKWARDS_COMPATIBLE_RESET_DEFINES, Add backwards compatible defines for the USB reset interface, type=bool, default=1, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_BACKWARDS_COMPATIBLE_RESET_DEFINES
#define PICO_STDIO_USB_BACKWARDS_COMPATIBLE_RESET_DEFINES 1
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -148,4 +153,18 @@ void stdio_usb_call_chars_available_callback(void);
}
#endif

#if PICO_STDIO_USB_BACKWARDS_COMPATIBLE_RESET_DEFINES
#include "pico/usb_reset_config.h"
#define PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE PICO_ENABLE_USB_RESET_VIA_BAUD_RATE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do each of these need to be wrapped in an #ifndef? E.g.

#ifndef PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE
#define PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE PICO_ENABLE_USB_RESET_VIA_BAUD_RATE
#endif

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that sort of wrapping should already be handled in pico/usb_reset_config.h

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh actually, yes, they will need some sort of wrapping to prevent duplicate definitions (although the duplicate definitions would be the same value, as that is handled in pico/usb_reset_config.h)

#define PICO_STDIO_USB_RESET_MAGIC_BAUD_RATE PICO_USB_RESET_MAGIC_BAUD_RATE
#define PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE PICO_ENABLE_USB_RESET_VIA_VENDOR_INTERFACE
#define PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR PICO_USB_RESET_SUPPORT_MS_OS_20_DESCRIPTOR
#define PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL PICO_USB_RESET_SUPPORT_RESET_TO_BOOTSEL
#define PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED_ACTIVE_LOW PICO_USB_RESET_BOOTSEL_ACTIVITY_LED_ACTIVE_LOW
#define PICO_STDIO_USB_RESET_BOOTSEL_FIXED_ACTIVITY_LED PICO_USB_RESET_BOOTSEL_FIXED_ACTIVITY_LED
#define PICO_STDIO_USB_RESET_BOOTSEL_INTERFACE_DISABLE_MASK PICO_USB_RESET_BOOTSEL_INTERFACE_DISABLE_MASK
#define PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_FLASH_BOOT PICO_USB_RESET_SUPPORT_RESET_TO_FLASH_BOOT
#define PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS PICO_USB_RESET_RESET_TO_FLASH_DELAY_MS
#endif // PICO_STDIO_USB_BACKWARDS_COMPATIBLE_RESET_DEFINES

#endif
Loading