WIP switching to pico-pio-usb
This commit is contained in:
parent
6805b1191b
commit
d0a29092b6
3 changed files with 17 additions and 1 deletions
|
|
@ -51,6 +51,10 @@ set(HSTX_D2P 19 CACHE STRING "HSTX D2+ PIN")
|
||||||
option(USE_VGA_RES "Video uses VGA (640x480) resolution" OFF)
|
option(USE_VGA_RES "Video uses VGA (640x480) resolution" OFF)
|
||||||
set(VIDEO_PIN 18 CACHE STRING "VGA Video GPIO base pin (followed by VS, CLK, HS)")
|
set(VIDEO_PIN 18 CACHE STRING "VGA Video GPIO base pin (followed by VS, CLK, HS)")
|
||||||
|
|
||||||
|
# Pins for PIO-based USB host
|
||||||
|
set(PIN_USB_HOST_DP CACHE STRING "1")
|
||||||
|
set(PIN_USB_HOST_DM CACHE STRING "2")
|
||||||
|
|
||||||
# See below, -DMEMSIZE=<size in KB> will configure umac's memory size,
|
# See below, -DMEMSIZE=<size in KB> will configure umac's memory size,
|
||||||
# overriding defaults.
|
# overriding defaults.
|
||||||
|
|
||||||
|
|
@ -122,6 +126,9 @@ else()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_compile_definitions(PIN_USB_HOST_DP=${PIN_USB_HOST_DP})
|
||||||
|
add_compile_definitions(PIN_USB_HOST_DM=${PIN_USB_HOST_DM})
|
||||||
|
|
||||||
if (TARGET tinyusb_device)
|
if (TARGET tinyusb_device)
|
||||||
add_executable(firmware
|
add_executable(firmware
|
||||||
src/main.c
|
src/main.c
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@
|
||||||
// max device support (excluding hub device)
|
// max device support (excluding hub device)
|
||||||
#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) // hub typically has 4 ports
|
#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) // hub typically has 4 ports
|
||||||
|
|
||||||
|
#define CFG_TUH_RPI_PIO_USB 1
|
||||||
|
|
||||||
//------------- HID -------------//
|
//------------- HID -------------//
|
||||||
#define CFG_TUH_HID_EPIN_BUFSIZE 64
|
#define CFG_TUH_HID_EPIN_BUFSIZE 64
|
||||||
#define CFG_TUH_HID_EPOUT_BUFSIZE 64
|
#define CFG_TUH_HID_EPOUT_BUFSIZE 64
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,14 @@ int main()
|
||||||
multicore_launch_core1(core1_main);
|
multicore_launch_core1(core1_main);
|
||||||
|
|
||||||
printf("Starting, init usb\n");
|
printf("Starting, init usb\n");
|
||||||
tusb_init();
|
|
||||||
|
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");
|
||||||
|
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);
|
||||||
|
|
||||||
|
tuh_init(BOARD_TUH_RHPORT);
|
||||||
|
|
||||||
/* This happens on core 0: */
|
/* This happens on core 0: */
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue