Some ports need an extra operation to ensure that the main task is
awoken so that a queued background task will execute during an ongoing
light sleep.
This removes the need to enable supervisor ticks while I2SOut is operating.
Closes: #3952
Originally, I believed the implementation might be shared with AudioOut,
as on the ESP32 (non-S2) the I2S peripheral was also used to drive the DAC.
However, this is not the case on ESP32-S2 and appears it will not be
the case with the ESP32-S3 or -C3, to the extent that there's skeletal
support for either of them in esp-idf master branch.
However, it could still be shared by I2SIn or PDMIn (the latter being
hypothetically implemented as I2SIn + digital postprocessing like we did
in the atmel-sam port, to my understanding), so I moved it to
the common-hal folder.
.. otherwise, the background callback to load the I2S fifos does not get
run. (I'm not sure this is _correct_ behavior of sleep + background
tasks, but it is the current behavior)
There were _possibly_ problems where this routine was being entered
by direct call AND by background callback. Schedule the work here,
and it will be done almost immediately, without worry about interference.
I don't know if this is strictly necessary, but it doesn't hurt. Since
the I2S clock is being run all the time, we have to enter the background
task to fill the FIFO with zeros constantly anyway.
This can be useful so that e.g., on a Kaluga when programming via
the FTDI chip, you can override the variable to specify "--after=hard_reset"
to automatically return to running CircuitPython, choose a different
baud rate (921600 is about 2s faster than 460800), etc:
make BOARD=espressif_kaluga_1 ESPTOOL_FLAGS="-b 921600 --before=default_reset --after=hard_reset"
This line is only a magnet for conflicts; the date that circuitpython.pot
was modified can be extracted from git metadata. Additionally, when
we add "make translate" checking to pre-commit, this will avoid spurious
changes since the most straightforward implementation would otherwise
update this line every time pre-commit executed.