-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QEI: Unable to (safely) define encoder pins as pull-up #321
Comments
I'm guessing the unsafe workaround looks like this: // let enc_a = gpiob.pb6.into_pull_up_input(&mut gpiob.crl);
unsafe { PB6::<Input<PullUp>>::set_mode(&mut gpiob.crl) };
// let enc_b = gpiob.pb7.into_pull_up_input(&mut gpiob.crl);
unsafe { PB7::<Input<PullUp>>::set_mode(&mut gpiob.crl) }; |
Seems like a bug in Do you see any problems with that? |
Sorry. I've not seen this issue. What all allowed pin modes? Are they same for For any input you can replace it with: impl<TIM, REMAP, P1, P2, MODE> Pins<REMAP> for (P1, P2)
where
REMAP: Remap<Periph = TIM>,
P1: Ch1<REMAP> + gpio::PinExt<Mode = Input<MODE>>,
P2: Ch2<REMAP> + gpio::PinExt<Mode = Input<MODE>>,
{
} |
I am gonna look into it and will open a PR this weekend if I find the time |
From reading the reference manual, I cannot see a reason why any pullup/down/floating restrictions should be made on any "alternate function" input pin (which aren't really in any "alternate function" mode on this chip). For this cause, I would assume that Update: |
I have this bit of code, which attempts to enable pull-up resistors on PB6 and PB7, and then construct a quadrature encoder interface on top of those pins using TIM4:
This fails because apparently the
qei()
method expects the pins to be floating instead:Is there a way to do this safely and within the confines of the library? Note that this configuration seems to be valid as I have tested it using a C program generated in STM32CubeIDE and the behaviour is as I expect it.
The text was updated successfully, but these errors were encountered: