rp gpio: make pin_bank() inline

This allows set_high() etc to be inlined, toggling pins
should be much faster.
This commit is contained in:
Matt Johnston 2023-01-19 13:29:51 +08:00
parent f0ae1f9133
commit 83af513424

View File

@ -743,6 +743,7 @@ macro_rules! impl_pin {
($name:ident, $bank:expr, $pin_num:expr) => { ($name:ident, $bank:expr, $pin_num:expr) => {
impl Pin for peripherals::$name {} impl Pin for peripherals::$name {}
impl sealed::Pin for peripherals::$name { impl sealed::Pin for peripherals::$name {
#[inline]
fn pin_bank(&self) -> u8 { fn pin_bank(&self) -> u8 {
($bank as u8) * 32 + $pin_num ($bank as u8) * 32 + $pin_num
} }