File tree Expand file tree Collapse file tree 4 files changed +30
-1
lines changed
tests/circuitpython-manual/usb Expand file tree Collapse file tree 4 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
142
142
{ MP_OBJ_NEW_QSTR (MP_QSTR_D54 ), MP_ROM_PTR (& pin_GPIO_EMC_29 ) },
143
143
{ MP_OBJ_NEW_QSTR (MP_QSTR_QSPI_IO3 ), MP_ROM_PTR (& pin_GPIO_EMC_29 ) },
144
144
145
+ // USB Host
146
+ { MP_ROM_QSTR (MP_QSTR_USB_HOST_POWER ), MP_ROM_PTR (& pin_GPIO_EMC_40 ) },
147
+ { MP_ROM_QSTR (MP_QSTR_USB_HOST_DP ), MP_ROM_PTR (& pin_USB_OTG2_DP ) },
148
+ { MP_ROM_QSTR (MP_QSTR_USB_HOST_DM ), MP_ROM_PTR (& pin_USB_OTG2_DN ) },
149
+
145
150
{ MP_ROM_QSTR (MP_QSTR_I2C ), MP_ROM_PTR (& board_i2c_obj ) },
146
151
{ MP_ROM_QSTR (MP_QSTR_SPI ), MP_ROM_PTR (& board_spi_obj ) },
147
152
{ MP_ROM_QSTR (MP_QSTR_UART ), MP_ROM_PTR (& board_uart_obj ) },
Original file line number Diff line number Diff line change @@ -408,7 +408,11 @@ void port_idle_until_interrupt(void) {
408
408
common_hal_mcu_disable_interrupts ();
409
409
if (!background_callback_pending ()) {
410
410
NVIC_ClearPendingIRQ (SNVS_HP_WRAPPER_IRQn );
411
+ // Don't down clock on debug builds because it prevents the DAP from
412
+ // reading memory
413
+ #if CIRCUITPY_DEBUG == 0
411
414
CLOCK_SetMode (kCLOCK_ModeWait );
415
+ #endif
412
416
__WFI ();
413
417
CLOCK_SetMode (kCLOCK_ModeRun );
414
418
}
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ void serial_early_init(void) {
105
105
common_hal_busio_uart_never_reset (& debug_uart );
106
106
107
107
// Do an initial print so that we can confirm the serial output is working.
108
- debug_uart_printf ("Serial debug setup\n" );
108
+ debug_uart_printf ("Serial debug setup\r\ n" );
109
109
#endif
110
110
}
111
111
Original file line number Diff line number Diff line change
1
+ import usb_host
2
+ import board
3
+ import digitalio
4
+ import usb .core
5
+ import time
6
+
7
+ if hasattr (board , "USB_HOST_POWER" ):
8
+ d = digitalio .DigitalInOut (board .USB_HOST_POWER )
9
+ d .switch_to_output (value = True )
10
+ print ("USB power on" )
11
+
12
+ h = usb_host .Port (board .USB_HOST_DP , board .USB_HOST_DM )
13
+
14
+ while True :
15
+ for device in usb .core .find (find_all = True ):
16
+ print (device .idVendor , device .idProduct )
17
+ print (device .manufacturer , device .product )
18
+ print (device .serial_number )
19
+ print ()
20
+ time .sleep (10 )
You can’t perform that action at this time.
0 commit comments