Skip to content

Commit a105d66

Browse files
burrbullusbalbin
authored andcommitted
generic Pins
1 parent 64aa1ff commit a105d66

File tree

16 files changed

+2352
-839
lines changed

16 files changed

+2352
-839
lines changed

Cargo.toml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ authors = ["Vitaly Domnikov <[email protected]>"]
33
categories = ["embedded", "hardware-support", "no-std"]
44
description = "Peripheral access API for STM32G4 series microcontrollers"
55
documentation = "https://docs.rs/stm32g4xx-hal"
6-
edition = "2018"
6+
edition = "2021"
77
keywords = ["arm", "cortex-m", "stm32g4xx", "hal"]
88
license = "MIT/Apache-2.0"
99
name = "stm32g4xx-hal"
@@ -86,6 +86,14 @@ stm32g483 = ["stm32g4/stm32g483", "cat3", "adc3", "adc4", "adc5"]
8686
stm32g484 = ["stm32g4/stm32g484", "cat3", "adc3", "adc4", "adc5"]
8787
stm32g491 = ["stm32g4/stm32g491", "cat4", "adc3"]
8888
stm32g4a1 = ["stm32g4/stm32g4a1", "cat4", "adc3"]
89+
90+
91+
gpio-g43x = []
92+
93+
gpio-g47x = []
94+
95+
gpio-g49x = []
96+
8997
log-itm = ["cortex-m-log/itm"]
9098
log-rtt = []
9199
log-semihost = ["cortex-m-log/semihosting"]
@@ -103,9 +111,9 @@ adc4 = []
103111
adc5 = []
104112

105113
# Device category
106-
cat2 = []
107-
cat3 = []
108-
cat4 = []
114+
cat2 = ["gpio-g43x"]
115+
cat3 = ["gpio-g47x"]
116+
cat4 = ["gpio-g49x"]
109117

110118
can = ["dep:fdcan"]
111119

examples/button.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use stm32g4xx_hal::{
55
//delay::{DelayExt, SYSTDelayExt},
6-
gpio::{self, ExtiPin, GpioExt, Input, PullDown, SignalEdge},
6+
gpio::{self, ExtiPin, GpioExt, Input, SignalEdge},
77
rcc::RccExt,
88
stm32,
99
stm32::{interrupt, Interrupt},
@@ -15,7 +15,7 @@ use core::sync::atomic::{AtomicBool, Ordering};
1515
use cortex_m::{asm::wfi, interrupt::Mutex};
1616
use cortex_m_rt::entry;
1717

18-
type ButtonPin = gpio::PC13<Input<PullDown>>;
18+
type ButtonPin = gpio::PC13<Input>;
1919

2020
// Make LED pin globally available
2121
static G_BUTTON: Mutex<RefCell<Option<ButtonPin>>> = Mutex::new(RefCell::new(None));

examples/spi-sd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() -> ! {
3434
let gpiof = dp.GPIOF.split(&mut rcc);
3535

3636
let cs = {
37-
let mut cs = gpiof.pf8.into_push_pull_output();
37+
let mut cs = gpiof.pf0.into_push_pull_output();
3838
cs.set_high();
3939
cs
4040
};

src/comparator.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,6 @@ output_pin! {
621621
COMP1: PA6, 8,
622622
COMP1: PA11, 8,
623623
COMP1: PB8, 8,
624-
COMP1: PF4, 2,
625624

626625
COMP2: PA2, 8,
627626
COMP2: PA7, 8,
@@ -637,13 +636,10 @@ output_pin! {
637636
COMP4: PB14, 8,
638637
}
639638

640-
#[cfg(any(
641-
feature = "stm32g473",
642-
feature = "stm32g483",
643-
feature = "stm32g474",
644-
feature = "stm32g484",
645-
))]
639+
#[cfg(feature = "gpio-g47x")]
646640
output_pin! {
641+
COMP1: PF4, 2,
642+
647643
COMP5: PA9, 8,
648644
COMP5: PC7, 7,
649645

0 commit comments

Comments
 (0)