add usb host power for rev b
This commit is contained in:
parent
3626fbc64d
commit
5277cf0c4c
2 changed files with 10 additions and 2 deletions
|
|
@ -67,5 +67,6 @@
|
|||
|
||||
#define PIN_USB_HOST_DP (1u)
|
||||
#define PIN_USB_HOST_DM (2u)
|
||||
#define PIN_USB_HOST_VBUS (11u)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1591,11 +1591,18 @@ void emu_init(void)
|
|||
|
||||
#ifdef HAS_USBHOST
|
||||
pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG;
|
||||
_Static_assert(PIN_USB_HOST_DP + 1 == PIN_USB_HOST_DM || PIN_USB_HOST_DP - 1 == PIN_USB_HOST_DM, "Permitted USB D+/D- configuration");
|
||||
*Static*assert(PIN_USB_HOST_DP + 1 == PIN_USB_HOST_DM || PIN_USB_HOST_DP - 1 == PIN_USB_HOST_DM, "Permitted USB D+/D- configuration");
|
||||
pio_cfg.pinout = PIN_USB_HOST_DP + 1 == PIN_USB_HOST_DM ? PIO_USB_PINOUT_DPDM : PIO_USB_PINOUT_DMDP;
|
||||
pio_cfg.pin_dp = PIN_USB_HOST_DP;
|
||||
tuh_configure(BOARD_TUH_RHPORT, TUH_CFGID_RPI_PIO_USB_CONFIGURATION, &pio_cfg);
|
||||
|
||||
#ifdef PIN_USB_HOST_VBUS
|
||||
printf("Enabling USB host VBUS power on GP%d\r\n", PIN_USB_HOST_VBUS);
|
||||
gpio_init(PIN_USB_HOST_VBUS);
|
||||
gpio_set_dir(PIN_USB_HOST_VBUS, GPIO_OUT);
|
||||
gpio_put(PIN_USB_HOST_VBUS, 1);
|
||||
#endif
|
||||
|
||||
tuh_configure(BOARD_TUH_RHPORT, TUH_CFGID_RPI_PIO_USB_CONFIGURATION, &pio_cfg);
|
||||
printf("Init USB...\n");
|
||||
printf("USB D+/D- on GP%d and GP%d\r\n", PIN_USB_HOST_DP, PIN_USB_HOST_DM);
|
||||
printf("TinyUSB Host HID Controller Example\r\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue