File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
src/encoders/stm32hwencoder Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ int STM32HWEncoder::hasIndex() { return 0; }
2929void STM32HWEncoder::init () {
3030 // GPIO configuration
3131 TIM_TypeDef *InstanceA = (TIM_TypeDef *)pinmap_peripheral (_pinA, PinMap_TIM);
32+ if (!IS_TIM_ENCODER_INTERFACE_INSTANCE (InstanceA)) {
33+ initialized = false ;
34+ return ;
35+ }
3236 TIM_TypeDef *InstanceB = (TIM_TypeDef *)pinmap_peripheral (_pinB, PinMap_TIM);
3337 if (InstanceA != InstanceB) {
3438 initialized = false ;
@@ -37,6 +41,9 @@ void STM32HWEncoder::init() {
3741 pinmap_pinout (_pinA, PinMap_TIM);
3842 pinmap_pinout (_pinB, PinMap_TIM);
3943
44+ // TODO check width:
45+ // IS_TIM_32B_COUNTER_INSTANCE(InstanceA);
46+
4047 // set up timer for encoder
4148 encoder_handle.Init .Period = cpr - 1 ;
4249 encoder_handle.Init .Prescaler = 0 ;
You can’t perform that action at this time.
0 commit comments