The old way mapped each byte of nvm onto a distinct nvs key, but this
allowed storage of only a very small number of bytes out of the
theoretical capacity.
Reworked like this, about half of the nvs capacity can be used for
nvm, so you're guaranteed the ability to store 9kB this way.
This keeps the mutex info in the same spot in memory. "Statically
allocating it" with CircuitPython meant that the buffer moved when
the I2C object is moved to keep it alive for a display.
Fixes#4962
On ESP ctrl-c during fake sleep will now stop the sleep. A crash
on real deep sleep is now fixed as well. (Exception string saving
was crashing on reading the deep sleep exception.) Fixes#4010
This also fixes nRF fake sleep after the first time. The internal
variable wasn't being reset early enough. Fixes#4869
Passing in a PWMOut still works but is deprecated. It will be
removed in CircuitPython 8.0.0
This also switches STM32 timer indices and channel indices to
0-based in our pin data rather than `- 1` everywhere. The latter is
more bug prone.
Most of the way for #3264
Tested on Metro M0, Metro M4, Feather S2, Feather nRF52840, Feather
STM32F4 and Arduino RP2040.
This also removes the need to pin share because we don't use the
status LED while user code is running.
The status flashes fallback to the HW_STATUS LED if no RGB LED is
present. Each status has a unique blink pattern as well.
One caveat is the REPL state. In order to not pin share, we set the
RGB color once. PWM and single color will be shutoff immediately but
DotStars and NeoPixels will hold the color until the user overrides
it.
Fixes#4133
As MicroDev1 pointed out the problem is a divide by zero when calculating the duty cycle.
Maybe need to check again in `common_hal_pwmio_pwmout_set_frequency()`.
FeatherS2 crashes if you set the PWMOut frequency to 0.
This change will raise `ValueError: Invalid PWM frequency` if the requested frequency is 0.
(Lifted from the atmel-samd port)