Commit Graph

9 Commits

Author SHA1 Message Date
Scott Shawcroft 412eb87080
Switch to pin, frequency and duty_cycle PulseOut
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.
2021-07-26 18:35:49 -07:00
Lucian Copeland c504a85ecc Add shared bindings check for invalid frequency 2021-07-13 18:22:43 -04:00
Scott Shawcroft 3fda0c0a1b
Fix board builds and use MP_ERROR_TEXT in py and extmod 2021-05-05 17:51:52 -07:00
Dan Halbert 1512ca520b Fix PWMOut non-error handling and never reset 2021-03-19 09:57:21 -04:00
Dan Halbert b2d913412f merge from upstream 2021-03-18 23:14:43 -04:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Dan Halbert 08c5dbb003 use return values in STM PWMOut constructor, not exceptions 2021-03-11 08:52:47 -05:00
Jeff Epler ff1942cff6 Enable protomatter on RP2040 builds
Also found a race condition between timer_disable and redraw, which
would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable
or put a delay or print inside it.  That's what pausing inside reconstruct
fixes.

So that the "right timer" can be chosen, `timer_allocate` now gets the `self`
pointer.  It's guaranteed at this point that the pin information is accurate,
so you can e.g., find a PWM unit related to the pins themselves.
This required touching each port to add the parameter even though it's
unused everywhere but raspberrypi.
2021-02-12 08:25:15 -06:00
Scott Shawcroft 6857f98426
Split pulseio.PWMOut into pwmio
This gives us better granularity when implementing new ports because
PWMOut is commonly implemented before PulseIn and PulseOut.

Fixes #3211
2020-08-18 13:08:33 -07:00