Merge branch 'master' into midihost
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
#endif
|
||||
|
||||
// VBUS enable pin and its active state
|
||||
// #define PIO_USB_VBUSEN_PIN 22
|
||||
#define PIO_USB_VBUSEN_PIN 22
|
||||
|
||||
#ifndef PIO_USB_VBUSEN_STATE
|
||||
#define PIO_USB_VBUSEN_STATE 1
|
||||
|
||||
@@ -121,16 +121,6 @@ static uart_inst_t *uart_inst;
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
#ifdef LED_PIN
|
||||
bi_decl(bi_1pin_with_name(LED_PIN, "LED"));
|
||||
gpio_init(LED_PIN);
|
||||
gpio_set_dir(LED_PIN, GPIO_OUT);
|
||||
#endif
|
||||
|
||||
// Button
|
||||
#ifndef BUTTON_BOOTSEL
|
||||
#endif
|
||||
|
||||
#if CFG_TUH_RPI_PIO_USB || CFG_TUD_RPI_PIO_USB
|
||||
// Set the system clock to a multiple of 120mhz for bitbanging USB with pico-usb
|
||||
set_sys_clock_khz(120000, true);
|
||||
@@ -148,6 +138,16 @@ void board_init(void)
|
||||
tuh_configure(BOARD_TUH_RHPORT, TUH_CFGID_RPI_PIO_USB_CONFIGURATION, &pio_cfg);
|
||||
#endif
|
||||
|
||||
#ifdef LED_PIN
|
||||
bi_decl(bi_1pin_with_name(LED_PIN, "LED"));
|
||||
gpio_init(LED_PIN);
|
||||
gpio_set_dir(LED_PIN, GPIO_OUT);
|
||||
#endif
|
||||
|
||||
// Button
|
||||
#ifndef BUTTON_BOOTSEL
|
||||
#endif
|
||||
|
||||
#if defined(UART_DEV) && defined(LIB_PICO_STDIO_UART)
|
||||
bi_decl(bi_2pins_with_func(UART_TX_PIN, UART_TX_PIN, GPIO_FUNC_UART));
|
||||
uart_inst = uart_get_instance(UART_DEV);
|
||||
@@ -192,10 +192,13 @@ uint32_t board_button_read(void)
|
||||
int board_uart_read(uint8_t* buf, int len)
|
||||
{
|
||||
#ifdef UART_DEV
|
||||
for(int i=0;i<len;i++) {
|
||||
buf[i] = uart_getc(uart_inst);
|
||||
int count = 0;
|
||||
while ( (count < len) && uart_is_readable(uart_inst) )
|
||||
{
|
||||
buf[count] = uart_getc(uart_inst);
|
||||
count++;
|
||||
}
|
||||
return len;
|
||||
return count;
|
||||
#else
|
||||
(void) buf; (void) len;
|
||||
return 0;
|
||||
@@ -216,6 +219,11 @@ int board_uart_write(void const * buf, int len)
|
||||
#endif
|
||||
}
|
||||
|
||||
int board_getchar(void)
|
||||
{
|
||||
return getchar_timeout_us(0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB Interrupt Handler
|
||||
// rp2040 implementation will install approriate handler when initializing
|
||||
|
||||
Reference in New Issue
Block a user