rp2/modrp2: Disable other core, shorten delay to 8us in bootsel_button.

This function seems to work fine in multi-core applications now.

The delay is now in units of microseconds instead of depending on the clock
speed, and is adjustable by board configuration headers.

Also added documentation.
This commit is contained in:
David Grayson
2023-03-03 11:38:48 -08:00
committed by Damien George
parent 673957b643
commit f80d040c03
3 changed files with 35 additions and 26 deletions

View File

@@ -66,6 +66,17 @@ For running PIO programs, see :class:`rp2.StateMachine`.
>>> rp2.asm_pio_encode("set(0, 1)", 0)
57345
.. function:: bootsel_button()
Temporarily turns the QSPI_SS pin into an input and reads its value,
returning 1 for low and 0 for high.
On a typical RP2040 board with a BOOTSEL button, a return value of 1
indicates that the button is pressed.
Since this function temporarily disables access to the external flash
memory, it also temporarily disables interrupts and the other core to
prevent them from trying to execute code from flash.
.. class:: PIOASMError
This exception is raised from `asm_pio()` or `asm_pio_encode()` if there is