Browse Source

Implement GPIO for STM32F070

features/pwm
Jesse Braham 4 years ago
parent
commit
c68731fd4d
  1. 3
      Cargo.toml
  2. 22
      src/gpio.rs
  3. 2
      src/lib.rs

3
Cargo.toml

@ -53,6 +53,9 @@ stm32f030x4 = ["stm32f030x6"]
stm32f030x6 = ["stm32f030"]
stm32f030x8 = ["stm32f030", "stm32f0/stm32f0x0"]
stm32f030xc = ["stm32f030", "stm32f0/stm32f0x0"]
stm32f070 = ["stm32f0/stm32f0x0"]
stm32f070x6 = ["stm32f070"]
stm32f070xb = ["stm32f070"]
[profile.dev]
debug = true

22
src/gpio.rs

@ -497,7 +497,7 @@ macro_rules! gpio {
}
}
#[cfg(any(feature = "stm32f042", feature = "stm32f030",))]
#[cfg(any(feature = "stm32f042", feature = "stm32f030", feature = "stm32f070"))]
gpio!(GPIOA, gpioa, iopaen, PA, [
PA0: (pa0, 0, Input<Floating>),
PA1: (pa1, 1, Input<Floating>),
@ -517,7 +517,7 @@ gpio!(GPIOA, gpioa, iopaen, PA, [
PA15: (pa15, 15, Input<Floating>),
]);
#[cfg(any(feature = "stm32f042", feature = "stm32f030"))]
#[cfg(any(feature = "stm32f042", feature = "stm32f030", feature = "stm32f070"))]
gpio!(GPIOB, gpiob, iopben, PB, [
PB0: (pb0, 0, Input<Floating>),
PB1: (pb1, 1, Input<Floating>),
@ -544,7 +544,7 @@ gpio!(GPIOC, gpioc, iopcen, PC, [
PC15: (pc15, 15, Input<Floating>),
]);
#[cfg(feature = "stm32f030")]
#[cfg(any(feature = "stm32f030", feature = "stm32f070"))]
gpio!(GPIOC, gpioc, iopcen, PC, [
PC0: (pb0, 0, Input<Floating>),
PC1: (pb1, 1, Input<Floating>),
@ -564,12 +564,10 @@ gpio!(GPIOC, gpioc, iopcen, PC, [
PC15: (pb15, 15, Input<Floating>),
]);
// TODO Check if the bit is implemented yet
// In the device crate the iopden bit is missing, so it won't compile
// #[cfg(feature = "stm32f030")]
// gpio!(GPIOD, gpiod, iopden, PD, [
// PD2: (pd2, 2, Input<Floating>),
// ]);
#[cfg(any(feature = "stm32f030", feature = "stm32f070"))]
gpio!(GPIOD, gpiod, iopden, PD, [
PD2: (pd2, 2, Input<Floating>),
]);
#[cfg(feature = "stm32f042")]
gpio!(GPIOF, gpiof, iopfen, PF, [
@ -587,3 +585,9 @@ gpio!(GPIOF, gpiof, iopfen, PF, [
PF6: (pf6, 5, Input<Floating>),
PF7: (pf7, 5, Input<Floating>),
]);
#[cfg(feature = "stm32f070")]
gpio!(GPIOF, gpiof, iopfen, PF, [
PF0: (pf0, 0, Input<Floating>),
PF1: (pf1, 1, Input<Floating>),
]);

2
src/lib.rs

@ -6,7 +6,7 @@ pub use stm32f0;
#[cfg(feature = "stm32f042")]
pub use stm32f0::stm32f0x2 as stm32;
#[cfg(feature = "stm32f030")]
#[cfg(any(feature = "stm32f030", feature = "stm32f070"))]
pub use stm32f0::stm32f0x0 as stm32;
pub mod delay;

Loading…
Cancel
Save