Can I use a Pin as Timer source?
Can I use a Pin as Timer source?
Can I let Timer.counter() add 1 when Pin level changed.
Re: Can I use a Pin as Timer source?
You can if you use one of the timer channels that has ETR mode (ETR = External Trigger).
I have an example here: https://github.com/dhylands/upy-example ... counter.py
On the pyboard, you can look inside the build-PYBV11 directory for a file called pins_af.py. If you search in that file for _ETR then those are the pins that you can adapt freq_counter.py to use.
It looks like there are only 2 available: X1 (with TIM2_ETR or TIM8_ETR) or X6 (with TIM2_ETR). Other boards may expose different pins and give you more or less timer channels with ETR functionality exposed.
I have an example here: https://github.com/dhylands/upy-example ... counter.py
On the pyboard, you can look inside the build-PYBV11 directory for a file called pins_af.py. If you search in that file for _ETR then those are the pins that you can adapt freq_counter.py to use.
It looks like there are only 2 available: X1 (with TIM2_ETR or TIM8_ETR) or X6 (with TIM2_ETR). Other boards may expose different pins and give you more or less timer channels with ETR functionality exposed.