Timer.ENC_AB Example?
Posted: Wed May 13, 2020 2:09 pm
Does anyone have a really quick example of how to use Timer.ENC_AB?
I'm confused by the documentation is a few places.
1. I don't understand how to configure the Timer object. Timer.channel?
2. I don't understand how to configure the Pin to use an alternate function
3. Related to 1, I need a callback on rollover so I know direction at that point
I have found the enum for pin alternate functions, but don't really understand how to use it in the Pin definition, though I see I should set Pin.ALT, then pass alt as AF type, but haven't had any success.
enum {
AF_PIN_TYPE_TIM_CH1 = 0,
AF_PIN_TYPE_TIM_CH2,
...
Any help would be very much appreciated.
Thanks!
I'm confused by the documentation is a few places.
1. I don't understand how to configure the Timer object. Timer.channel?
2. I don't understand how to configure the Pin to use an alternate function
3. Related to 1, I need a callback on rollover so I know direction at that point
I have found the enum for pin alternate functions, but don't really understand how to use it in the Pin definition, though I see I should set Pin.ALT, then pass alt as AF type, but haven't had any success.
enum {
AF_PIN_TYPE_TIM_CH1 = 0,
AF_PIN_TYPE_TIM_CH2,
...
Any help would be very much appreciated.
Thanks!