Skip to content

Commit 573c566

Browse files
authored
enable power on GPIOG pins (#290)
1 parent e483546 commit 573c566

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/gpio.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<const P: char> PUPDR<P> {
234234
}
235235

236236
macro_rules! gpio {
237-
($GPIOX:ident, $gpiox:ident, $PXx:ident, $port_id:literal, $extigpionr:expr, [
237+
($GPIOX:ident, $gpiox:ident, $PXx:ident, $port_id:literal, $extigpionr:expr, $({ $pwrenable:expr },)? [
238238
$($PXi:ident: ($pxi:ident, $i:expr, $MODE:ty, $HL:ident, $exticri:ident),)+
239239
]) => {
240240
/// GPIO
@@ -274,6 +274,7 @@ macro_rules! gpio {
274274
fn split(self, ahb: &mut AHB2) -> Parts {
275275
<$GPIOX>::enable(ahb);
276276
<$GPIOX>::reset(ahb);
277+
$($pwrenable)?
277278

278279
Parts {
279280
afrh: Afr::new(),
@@ -753,7 +754,9 @@ gpio!(GPIOF, gpiof, PFx, 'F', 5, [
753754
feature = "stm32l4r9",
754755
feature = "stm32l4s9",
755756
))]
756-
gpio!(GPIOG, gpiog, PGx, 'G', 6, [
757+
gpio!(GPIOG, gpiog, PGx, 'G', 6,
758+
{ unsafe { (*crate::pac::PWR::ptr()).cr2.modify(|_,w| w.iosv().set_bit()); } },
759+
[
757760
PG0: (pg0, 0, Analog, L8, exticr1),
758761
PG1: (pg1, 1, Analog, L8, exticr1),
759762
PG2: (pg2, 2, Analog, L8, exticr1),

0 commit comments

Comments
 (0)