This adds I2SOut and PDMIn support via PIO.
StateMachines can now:
* read and read while writing
* transfer in 1, 2 or 4 byte increments
* init pins based on expected defaults automatically
* be stopped and restarted
* rxfifo can be cleared and rxstalls detected (good for tracking when
the reading code isn't keeping up)
Fixes#4162
Since the datasheet cast some doubt on the strength of the "rosc_hw->randombit",
I use the SHA256 hash function to create a high quality random seed
from random values of uncertain entropy, as well as to generate a sequence
of random values from that seed using SHA256 as a cryptographically-secure
random number generator.
In practice, it produces over 100kB/s of random data which does not
have any gross problems according to _PractRand_.
@Jerryneedell noticed that this problem affected strips short enough
to not use the DMA peripheral, thanks for the hot tip!
Instead of checking for background tasks after every byte transfer,
try up to 32 transfers before attending to background tasks.
This fixes the problem I was seeing on my 5-pixel circuit.
Closes#4135.
This makes all the following work:
* normal microcontroller.reset()
* reset into safe mode or UF2 bootloader via microcontroller.on_next_reset()
* reset into UF2 bootloader via the "1200 baud trick"
The implementation of reset_cpu is from micropython.
The RP2040 is new microcontroller from Raspberry Pi that features
two Cortex M0s and eight PIO state machines that are good for
crunching lots of data. It has 264k RAM and a built in UF2
bootloader too.
Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf