countio: add selectable rise and fall detection, pulls #5803
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses countio enhancements #5606.
Add selectable counting of rising or falling edges, or both (both is not possible on RP2040).
Add ability to specify a pull-up or pull-down.
The default was supposed to be falling, though on RP2040 it appears to have been rising. Fixed RP2040 to be consistent.
Renamed pin argument of
Counter()
to bepin
instead ofpin_a
. Not sure why it waspin_a
. That may be a leftover of something else.Remove
common_hal_countio_counter_reset()
, since it can be done bycommon_hal_countio_counter_set_count(pin, 0)
.Introduce
countio.Edge
enumeration. The alternative was to providerise
andfall
boolean arguments toCounter()
, but seems more consistent with other such multi-value arguments.Unrelated: Fix some kind of accidental typo for the symbolic link for
tests/pyboard.py
->../tools/cpboard.py
. The symoblic link included a literal newline character, which is not obvious from the file comparison below.Tested on all the implemented platforms:
raspberrypi
,espressif
,atmel-samd
,nrf
: