Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metro rp2350: Enable USB host by default #10005

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
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
27 changes: 27 additions & 0 deletions ports/raspberrypi/boards/adafruit_metro_rp2350/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@
//
// SPDX-License-Identifier: MIT

#include "common-hal/microcontroller/Pin.h"
#include "hardware/gpio.h"
#include "shared-bindings/usb_host/Port.h"
#include "supervisor/board.h"

// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.


#if defined(DEFAULT_USB_HOST_5V_POWER)
bool board_reset_pin_number(uint8_t pin_number) {
if (pin_number == DEFAULT_USB_HOST_5V_POWER->number) {
// doing this (rather than gpio_init) in this specific order ensures no
// glitch if pin was already configured as a high output. gpio_init() temporarily
// configures the pin as an input, so the power enable value would potentially
// glitch.
gpio_put(pin_number, 1);
gpio_set_dir(pin_number, GPIO_OUT);
gpio_set_function(pin_number, GPIO_FUNC_SIO);

return true;
}
return false;
}
#endif

#if defined(DEFAULT_USB_HOST_DATA_PLUS)
void board_init(void) {
common_hal_usb_host_port_construct(DEFAULT_USB_HOST_DATA_PLUS, DEFAULT_USB_HOST_DATA_MINUS);
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@
// #define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX
// #define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX

#define DEFAULT_USB_HOST_DATA_PLUS (&pin_GPIO32)
#define DEFAULT_USB_HOST_DATA_MINUS (&pin_GPIO33)
#define DEFAULT_USB_HOST_5V_POWER (&pin_GPIO29)
#define CIRCUITPY_PSRAM_CHIP_SELECT (&pin_GPIO47)