keyboard works on fruitjam
Together with Pico-PIO-USB at 6d14098 "Wait for PRE to finish. Comment timeout" (https://github.com/sekigon-gonnoc/Pico-PIO-USB/pull/164)
This commit is contained in:
parent
16b0f3b75b
commit
3b9c35c30a
5 changed files with 14 additions and 4 deletions
|
|
@ -65,4 +65,7 @@
|
|||
#define PIN_D1P (17u)
|
||||
#define PIN_D2P (19u)
|
||||
|
||||
#define PIN_USB_HOST_DP (1u)
|
||||
#define PIN_USB_HOST_DM (2u)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#define INVX 1
|
||||
#define HAS_SND 1
|
||||
#define USE_VGA 1
|
||||
//#define HAS_USBHOST 1
|
||||
#define HAS_USBHOST 1
|
||||
#define HAS_USBPIO 1
|
||||
|
||||
//#define ILI9341 1
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ extern "C" {
|
|||
#include <ctype.h>
|
||||
#include "tusb.h"
|
||||
#include "kbd.h"
|
||||
#include "pio_usb_configuration.h"
|
||||
#endif
|
||||
|
||||
static bool emu_writeConfig(void);
|
||||
|
|
@ -1444,8 +1445,14 @@ void emu_init(void)
|
|||
bool forceVga = false;
|
||||
|
||||
#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");
|
||||
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);
|
||||
|
||||
printf("Init USB...\n");
|
||||
printf("USB D+/D- on GP%d and GP%d\r\n", PIO_USB_DP_PIN_DEFAULT, PIO_USB_DP_PIN_DEFAULT+1);
|
||||
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");
|
||||
tuh_init(BOARD_TUH_RHPORT);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ int main(void) {
|
|||
// set_sys_clock_khz(225000, true);
|
||||
|
||||
#ifdef HAS_USBPIO
|
||||
set_sys_clock_khz(140000, true);
|
||||
set_sys_clock_khz(120000, true);
|
||||
#else
|
||||
set_sys_clock_khz(280000, true);
|
||||
*((uint32_t *)(0x40010000+0x58)) = 2 << 16; //CLK_HSTX_DIV = 2 << 16; // HSTX clock/2
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@
|
|||
// Size of buffer to hold descriptors and other data used for enumeration
|
||||
#define CFG_TUH_ENUMERATION_BUFSIZE 256
|
||||
|
||||
#define CFG_TUH_HUB 0
|
||||
#define CFG_TUH_HUB 1
|
||||
#define CFG_TUH_CDC 0
|
||||
#define CFG_TUH_HID 4 // typical keyboard + mouse device can have 3-4 HID interfaces
|
||||
#define CFG_TUH_MSC 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue