Browse Source

Add support for stm32f048

trying.tmp
Jesse Braham 4 years ago
parent
commit
e225bc0f68
  1. 1
      Cargo.toml
  2. 3
      src/adc.rs
  3. 4
      src/gpio.rs
  4. 16
      src/i2c.rs
  5. 2
      src/lib.rs
  6. 3
      src/serial.rs
  7. 3
      src/spi.rs
  8. 1
      src/timers.rs

1
Cargo.toml

@ -57,6 +57,7 @@ stm32f030xc = ["stm32f030"]
stm32f031 = ["stm32f0/stm32f0x1", "device-selected"]
stm32f038 = ["stm32f0/stm32f0x8", "device-selected"]
stm32f042 = ["stm32f0/stm32f0x2", "device-selected"]
stm32f048 = ["stm32f0/stm32f0x8", "device-selected"]
stm32f051 = ["stm32f0/stm32f0x1", "device-selected"]
stm32f070 = ["stm32f0/stm32f0x0", "device-selected"]
stm32f070x6 = ["stm32f070"]

3
src/adc.rs

@ -356,6 +356,7 @@ impl VRef {
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f071",
feature = "stm32f072",
@ -369,6 +370,7 @@ pub struct VBat;
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f071",
feature = "stm32f072",
@ -382,6 +384,7 @@ adc_pins!(
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f071",
feature = "stm32f072",

4
src/gpio.rs

@ -561,7 +561,7 @@ gpio!(GPIOB, gpiob, iopben, PB, [
PB15: (pb15, 15, Input<Floating>),
]);
#[cfg(any(feature = "stm32f038", feature = "stm32f042"))]
#[cfg(any(feature = "stm32f038", feature = "stm32f042", feature = "stm32f048"))]
gpio!(GPIOC, gpioc, iopcen, PC, [
PC13: (pc13, 13, Input<Floating>),
PC14: (pc14, 14, Input<Floating>),
@ -667,7 +667,7 @@ gpio!(GPIOF, gpiof, iopfen, PF, [
PF7: (pf7, 7, Input<Floating>),
]);
#[cfg(feature = "stm32f042")]
#[cfg(any(feature = "stm32f042", feature = "stm32f048"))]
gpio!(GPIOF, gpiof, iopfen, PF, [
PF0: (pf0, 0, Input<Floating>),
PF1: (pf1, 1, Input<Floating>),

16
src/i2c.rs

@ -38,6 +38,7 @@ macro_rules! i2c_pins {
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f070",
feature = "stm32f071",
@ -55,6 +56,7 @@ i2c_pins! {
feature = "stm32f030xc",
feature = "stm32f031",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f091",
))]
i2c_pins! {
@ -63,7 +65,7 @@ i2c_pins! {
sda => [gpioa::PA10<Alternate<AF4>>],
}
}
#[cfg(any(feature = "stm32f030", feature = "stm32f042"))]
#[cfg(any(feature = "stm32f030", feature = "stm32f042", feature = "stm32f048"))]
i2c_pins! {
I2C1 => {
scl => [gpioa::PA11<Alternate<AF5>>],
@ -74,6 +76,7 @@ i2c_pins! {
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f030x6",
))]
i2c_pins! {
@ -82,11 +85,18 @@ i2c_pins! {
sda => [gpiob::PB11<Alternate<AF1>>],
}
}
#[cfg(any(feature = "stm32f030xc", feature = "stm32f042", feature = "stm32f048"))]
i2c_pins! {
I2C1 => {
scl => [gpiob::PB13<Alternate<AF5>>],
sda => [gpiob::PB14<Alternate<AF5>>],
}
}
#[cfg(any(feature = "stm32f042", feature = "stm32f030xc"))]
i2c_pins! {
I2C1 => {
scl => [gpiob::PB13<Alternate<AF5>>, gpiof::PF1<Alternate<AF1>>],
sda => [gpiob::PB14<Alternate<AF5>>, gpiof::PF0<Alternate<AF1>>],
scl => [gpiof::PF1<Alternate<AF1>>],
sda => [gpiof::PF0<Alternate<AF1>>],
}
}
#[cfg(feature = "stm32f070x6")]

2
src/lib.rs

@ -17,7 +17,7 @@ pub use stm32f0::stm32f0x1 as stm32;
#[cfg(any(feature = "stm32f042", feature = "stm32f072"))]
pub use stm32f0::stm32f0x2 as stm32;
#[cfg(feature = "stm32f038")]
#[cfg(any(feature = "stm32f038", feature = "stm32f048"))]
pub use stm32f0::stm32f0x8 as stm32;
#[cfg(feature = "device-selected")]

3
src/serial.rs

@ -117,6 +117,7 @@ macro_rules! usart_pins {
#[cfg(any(
feature = "stm32f030",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f071",
))]
@ -151,6 +152,7 @@ usart_pins! {
feature = "stm32f030x8",
feature = "stm32f030xc",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f070",
feature = "stm32f071",
@ -366,6 +368,7 @@ usart! {
feature = "stm32f030x8",
feature = "stm32f030xc",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f070",
feature = "stm32f071",

3
src/spi.rs

@ -49,6 +49,7 @@ use crate::stm32::SPI1;
#[cfg(any(
feature = "stm32f030x8",
feature = "stm32f030xc",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f070xb",
feature = "stm32f071",
@ -135,6 +136,7 @@ spi_pins! {
#[cfg(any(
feature = "stm32f030x8",
feature = "stm32f030xc",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f070xb",
feature = "stm32f071",
@ -209,6 +211,7 @@ spi! {
#[cfg(any(
feature = "stm32f030x8",
feature = "stm32f030xc",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f070xb",
feature = "stm32f071",

1
src/timers.rs

@ -226,6 +226,7 @@ timers! {
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f051",
feature = "stm32f071",
feature = "stm32f072",

Loading…
Cancel
Save