From f80d040c038c343b0709eba537014fb52bc8115e Mon Sep 17 00:00:00 2001 From: David Grayson Date: Fri, 3 Mar 2023 11:38:48 -0800 Subject: 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. --- docs/library/rp2.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs/library') diff --git a/docs/library/rp2.rst b/docs/library/rp2.rst index ec7666d7c..7a473387b 100644 --- a/docs/library/rp2.rst +++ b/docs/library/rp2.rst @@ -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 -- cgit v1.2.3