Use ODR register for Pull::Up or Down
This commit is contained in:
parent
cc6998be30
commit
2f7bba4668
1 changed files with 12 additions and 10 deletions
|
@ -689,17 +689,19 @@ pub(crate) trait SealedPin {
|
||||||
#[cfg(gpio_v1)]
|
#[cfg(gpio_v1)]
|
||||||
{
|
{
|
||||||
let crlh = if n < 8 { 0 } else { 1 };
|
let crlh = if n < 8 { 0 } else { 1 };
|
||||||
match r.cr(crlh).cnf(n % 8) {
|
match r.cr(crlh).read().mode(n % 8) {
|
||||||
vals::CnfIn::FLOATING => Pull::None,
|
vals::Mode::INPUT => {
|
||||||
_ => {
|
match r.cr(crlh).read().cnf_in(n % 8) {
|
||||||
if r.bsrr().read().bs(n % 8) {
|
vals::CnfIn::PULL => {
|
||||||
Pull::Up
|
match r.odr().read().odr(n % 8) {
|
||||||
} else if r.bsrr().read().br(n % 8) {
|
vals::Odr::LOW => Pull::Down,
|
||||||
Pull::Down
|
vals::Odr::HIGH => Pull::Up
|
||||||
} else {
|
|
||||||
Pull::None
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
_ => Pull::None
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
_ => Pull::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(gpio_v2)]
|
#[cfg(gpio_v2)]
|
||||||
|
|
Loading…
Reference in a new issue