Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Vitaly Domnikov <[email protected]>"]
categories = ["embedded", "hardware-support", "no-std"]
description = "Peripheral access API for STM32G4 series microcontrollers"
documentation = "https://docs.rs/stm32g4xx-hal"
edition = "2018"
edition = "2021"
keywords = ["arm", "cortex-m", "stm32g4xx", "hal"]
license = "MIT/Apache-2.0"
name = "stm32g4xx-hal"
Expand Down Expand Up @@ -86,6 +86,14 @@ stm32g483 = ["stm32g4/stm32g483", "cat3", "adc3", "adc4", "adc5"]
stm32g484 = ["stm32g4/stm32g484", "cat3", "adc3", "adc4", "adc5"]
stm32g491 = ["stm32g4/stm32g491", "cat4", "adc3"]
stm32g4a1 = ["stm32g4/stm32g4a1", "cat4", "adc3"]


gpio-g43x = []

gpio-g47x = []

gpio-g49x = []

log-itm = ["cortex-m-log/itm"]
log-rtt = []
log-semihost = ["cortex-m-log/semihosting"]
Expand All @@ -103,9 +111,9 @@ adc4 = []
adc5 = []

# Device category
cat2 = []
cat3 = []
cat4 = []
cat2 = ["gpio-g43x"]
cat3 = ["gpio-g47x"]
cat4 = ["gpio-g49x"]

can = ["dep:fdcan"]

Expand Down
4 changes: 2 additions & 2 deletions examples/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use stm32g4xx_hal::{
//delay::{DelayExt, SYSTDelayExt},
gpio::{self, ExtiPin, GpioExt, Input, PullDown, SignalEdge},
gpio::{self, ExtiPin, GpioExt, Input, SignalEdge},
rcc::RccExt,
stm32,
stm32::{interrupt, Interrupt},
Expand All @@ -15,7 +15,7 @@ use core::sync::atomic::{AtomicBool, Ordering};
use cortex_m::{asm::wfi, interrupt::Mutex};
use cortex_m_rt::entry;

type ButtonPin = gpio::PC13<Input<PullDown>>;
type ButtonPin = gpio::PC13<Input>;

// Make LED pin globally available
static G_BUTTON: Mutex<RefCell<Option<ButtonPin>>> = Mutex::new(RefCell::new(None));
Expand Down
2 changes: 1 addition & 1 deletion examples/spi-sd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn main() -> ! {
let gpiof = dp.GPIOF.split(&mut rcc);

let cs = {
let mut cs = gpiof.pf8.into_push_pull_output();
let mut cs = gpiof.pf0.into_push_pull_output();
cs.set_high();
cs
};
Expand Down
10 changes: 3 additions & 7 deletions src/comparator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ output_pin! {
COMP1: PA6, 8,
COMP1: PA11, 8,
COMP1: PB8, 8,
COMP1: PF4, 2,

COMP2: PA2, 8,
COMP2: PA7, 8,
Expand All @@ -637,13 +636,10 @@ output_pin! {
COMP4: PB14, 8,
}

#[cfg(any(
feature = "stm32g473",
feature = "stm32g483",
feature = "stm32g474",
feature = "stm32g484",
))]
#[cfg(feature = "gpio-g47x")]
output_pin! {
COMP1: PF4, 2,

COMP5: PA9, 8,
COMP5: PC7, 7,

Expand Down
14 changes: 7 additions & 7 deletions src/dac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use core::marker::PhantomData;
use core::mem::MaybeUninit;
use core::ops::Deref;

use crate::gpio::{DefaultMode, PA4, PA5, PA6};
use crate::gpio::{Analog, PA4, PA5, PA6};
use crate::pac;
use crate::rcc::{self, *};
use crate::stm32::dac1::mcr::HFSEL;
Expand Down Expand Up @@ -223,27 +223,27 @@ macro_rules! impl_dac1_ch2_combos {
$(impl_pin_for_dac!(DAC1: $pin_ch1, // ch2: Not used
$output_ch1
);)*
impl_pin_for_dac!(DAC1: ($($pin_ch1,)* PA5<DefaultMode>), // ch2: Ext pin
impl_pin_for_dac!(DAC1: ($($pin_ch1,)* PA5<Analog>), // ch2: Ext pin
($($output_ch1,)* Dac1Ch2<M_EXT_PIN, Disabled>)
);
impl_pin_for_dac!(DAC1: ($($pin_ch1,)* Dac1IntSig2), // ch2: Internal
($($output_ch1,)* Dac1Ch2<M_INT_SIG, Disabled>)
);
impl_pin_for_dac!(DAC1: ($($pin_ch1,)* (PA5<DefaultMode>, Dac1IntSig2)),// ch2: Mixed
impl_pin_for_dac!(DAC1: ($($pin_ch1,)* (PA5<Analog>, Dac1IntSig2)),// ch2: Mixed
($($output_ch1,)* Dac1Ch2<M_MIX_SIG, Disabled>)
);
};
}

impl_dac1_ch2_combos!(); // ch1: Not used
impl_dac1_ch2_combos!(PA4<DefaultMode>, Dac1Ch1<M_EXT_PIN, Disabled>); // ch1: Ext pin
impl_dac1_ch2_combos!(PA4<Analog>, Dac1Ch1<M_EXT_PIN, Disabled>); // ch1: Ext pin
impl_dac1_ch2_combos!(Dac1IntSig1, Dac1Ch1<M_INT_SIG, Disabled>); // ch1: Internal
impl_dac1_ch2_combos!((PA4<DefaultMode>, Dac1IntSig1), Dac1Ch1<M_MIX_SIG, Disabled>); // ch1: Mixed
impl_dac1_ch2_combos!((PA4<Analog>, Dac1IntSig1), Dac1Ch1<M_MIX_SIG, Disabled>); // ch1: Mixed

// DAC2
impl_pin_for_dac!(DAC2: PA6<DefaultMode>, Dac2Ch1<M_EXT_PIN, Disabled>); // ch1: Ext pin
impl_pin_for_dac!(DAC2: PA6<Analog>, Dac2Ch1<M_EXT_PIN, Disabled>); // ch1: Ext pin
impl_pin_for_dac!(DAC2: Dac2IntSig1, Dac2Ch1<M_INT_SIG, Disabled>); // ch1: Internal
impl_pin_for_dac!(DAC2: (PA6<DefaultMode>, Dac2IntSig1), Dac2Ch1<M_MIX_SIG, Disabled>); // ch1: Mixed
impl_pin_for_dac!(DAC2: (PA6<Analog>, Dac2IntSig1), Dac2Ch1<M_MIX_SIG, Disabled>); // ch1: Mixed

// DAC3 int
impl_pin_for_dac!(DAC3: Dac3IntSig1, Dac3Ch1<M_INT_SIG, Disabled>);
Expand Down
Loading
Loading