Commit Graph

70 Commits

Author SHA1 Message Date
root 0e2431048d Fix PWMOut on SAMD21 2021-04-20 15:21:05 -05:00
Scott Shawcroft 379e73af2e
Finer grained, per port tick locking
Fixes #3504 hopefully.
2020-10-12 18:43:21 -07:00
DavePutz 2a2a8d6457
Merge pull request #28 from adafruit/main
Merge from adafruit/main
2020-09-14 16:50:40 -05:00
DavePutz 2eca4ee902
Update PulseIn.c 2020-09-14 11:04:45 -05:00
DavePutz c014ac3089
Reworked check for input taking too long 2020-09-14 10:54:57 -05:00
Lucian Copeland 8021da08d3 Fix problematic whitespace on pulseout parameter errors 2020-08-27 11:07:47 -04:00
root fe0f79adce Making requested modifications 2020-08-21 20:38:19 -05:00
Scott Shawcroft a5b01f7361
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-21 11:13:53 -07:00
root 6eae7ce78f Requested changes to pulsein 2020-08-20 16:57:00 -05: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
Lucian Copeland da75445cd5 Style changes, reposition runtime errors 2020-08-18 11:42:06 -04:00
Lucian Copeland 0fc730bc5a Expand PulseOut API, debug cleanup 2020-08-14 16:36:02 -04:00
root c7b6e66426 Fixes for pulsein tick handling 2020-08-05 10:03:20 -05:00
Jeff Epler 93b373d617 "pop from empty %q"
Saves 12 bytes code on trinket m0
2020-08-04 18:42:09 -05:00
Jeff Epler c849b781c0 Combine 'index out of range' messages 2020-08-04 14:45:45 -05:00
Jeff Epler dddd25a776 Combine similar strings to reduce size of translations
This is a slight trade-off with code size, in places where a "_varg"
mp_raise variant is now used.  The net savings on trinket_m0 is
just 32 bytes.

It also means that the translation will include the original English
text, and cannot be translated.  These are usually names of Python
types such as int, set, or dict or special values such as "inf" or
"Nan".
2020-08-04 13:34:29 -05:00
root 9203a77804 Turn off interrupts while in handler 2020-08-03 11:31:12 -05:00
root 12b81618a3 Changes for getting supervisor ticks 2020-08-01 13:27:02 -05:00
Jeff Epler 1df48176ce supervisor: factor supervisor_background_tasks from sundry ports 2020-07-15 11:49:44 -05:00
Scott Shawcroft 51c888d4be
Merge pull request #3003 from Flameeyes/master
License tagging according to REUSE specifications.
2020-07-13 16:28:49 -07:00
Diego Elio Pettenò 34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01:00
DavePutz 94d90742dd
Implementation of RTC continuous synchronization during pulsein
Flags and code to implement RTC continuous synchronization during pulsein
2020-07-04 21:15:38 -05:00
Jeff Epler da733c01da atmel-samd: Add support for SAM E54 family MCUs
This introduces the new macro SAM_D5X_E5X.  This is mostly the same
as SAMD51 before, except in a few places where a special case for
SAME54 is required
2020-06-23 10:41:48 -05:00
DavePutz 2e05f628f0
Add an increment to tcc_refcount to allow deinits to work properly 2020-05-21 11:08:26 -05:00
Scott Shawcroft b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler 09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00
Scott Shawcroft d0a25ca9ac
Tweaks based on dhalberts feedback 2020-04-08 10:49:46 -07:00
Scott Shawcroft e99cf6e441
Rework sleep timing
It didn't account for background task time and could end up
sleeping for way longer than it should because the RTC compare time
had already passed.
2020-04-03 18:07:56 -07:00
Scott Shawcroft 46af4bdd0e
Fix SAMD21 PulseIn 2020-04-02 17:35:52 -07:00
Scott Shawcroft 76ca13b6ed
Fix SAMD51 pulsein 2020-03-13 17:21:15 -07:00
Scott Shawcroft 48b5f2a384
Initial work on SAMD 2020-03-13 11:16:41 -07:00
Dan Halbert b6206406de new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:43:04 -05:00
Thea Flowers 4b742f88d9
Fix spelling 2019-10-25 10:50:27 -07:00
Thea Flowers 4fdf518251
Track unadjusted PWM duty cycle to avoid accumulating conversion errors
Fixes #2086

When the frequency of a `PWMOut` is change it re-sets the PWM's duty cycle as
well, since the registers have to be re-calculated based on the new frequency.
Unfortunately, `common_hal_pulseio_pwmout_get_duty_cycle`
will return a value very close to, but not exactly, the value passed to `common_hal_pulseio_pwmout_set_duty_cycle`. If the frequency is modified
without the calling code also re-setting the duty cycle then the duty cycle
will decay over time. This fixes that problem by tracking the unadjusted duty
cycle and re-setting the duty cycle to that value when the frequency is changed.
2019-10-23 14:34:14 -07:00
Jeff Epler d9ee2d28a0 atmel-samd: Use RUN_BACKGROUND_TASKS 2019-08-11 08:53:02 -05:00
Dan Halbert cdd77b5972 remove CPy-specific EIC handlers from samd-peripherals 2019-04-04 16:04:11 -04:00
Dan Halbert 97140e6a62 wrong arg type for PWMOut variable_frequency 2019-03-12 21:28:30 -04:00
Dan Halbert 3c24e893e9 Fix SYNCBUSY loop typo. 2019-02-28 23:38:26 -05:00
Dan Halbert 808304e827 Use TCC LUPD lock when updating CCB 2019-02-28 19:53:35 -05:00
sommersoft 55e7c5a41b handle 'set_timer_handler' on this side, vs samd-periphs. 2019-02-19 20:18:21 -06:00
sommersoft dafc370d22 moves 'shared_timer_handler' back to atmel-samd from samd-peripherals 2019-02-16 19:54:16 -06:00
Scott Shawcroft 69bc5e189b
Rudamentary backlight support 2019-01-31 11:42:14 -08:00
Dan Halbert bc510e714f merge 3.0.2 to master 2018-09-18 15:38:12 -04:00
Dan Halbert c3918bae57 PWMOut was not claming channels on shared TCCs 2018-09-11 19:46:47 -04:00
Dan Halbert 9ea809bef7 add pin claiming to devices 2018-08-31 18:38:05 -04:00
Scott Shawcroft 933add6cd8
Support internationalisation. 2018-08-07 14:58:57 -07:00
Scott Shawcroft 168aa394db
Move pin struct to the peripherals library.
Its slimmed down by removing the qstr and bit packing TCC info.

The trinket m0 build actually grows by 20 bytes. The arduino zero
build shrinks by 188 bytes.
2018-08-02 13:59:05 -07:00
Scott Shawcroft a5e03b76a6 Split out the peripherals library in preparation of sharing with MakeCode. 2018-06-15 16:16:21 -07:00
Scott Shawcroft 8fb34a5846 Use bool not int. 2018-06-08 14:57:20 -07:00
Scott Shawcroft 2fbab8067a Prevent freezing USB during high frequency PulseIn.
We now track the last time the background task ran and bail on the
PulseIn if it starves the background work. In practice, this
happens after the numbers from pulsein are no longer accurate.

This also adjusts interrupt priorities so most are the lowest level
except for the tick and USB interrupts.

Fixes #516 and #876
2018-06-08 12:56:32 -07:00