Browse Source

Add support for stm32f038

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

1
Cargo.toml

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

3
src/adc.rs

@ -354,6 +354,7 @@ impl VRef {
#[cfg(any(
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f051",
feature = "stm32f071",
@ -366,6 +367,7 @@ pub struct VBat;
#[cfg(any(
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f051",
feature = "stm32f071",
@ -378,6 +380,7 @@ adc_pins!(
#[cfg(any(
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f051",
feature = "stm32f071",

24
src/gpio.rs

@ -561,7 +561,7 @@ gpio!(GPIOB, gpiob, iopben, PB, [
PB15: (pb15, 15, Input<Floating>),
]);
#[cfg(feature = "stm32f042")]
#[cfg(any(feature = "stm32f038", feature = "stm32f042"))]
gpio!(GPIOC, gpioc, iopcen, PC, [
PC13: (pc13, 13, Input<Floating>),
PC14: (pc14, 14, Input<Floating>),
@ -643,13 +643,6 @@ gpio!(GPIOD, gpiod, iopden, PD, [
// PE15: (pe15, 15, Input<Floating>),
// ]);
#[cfg(feature = "stm32f042")]
gpio!(GPIOF, gpiof, iopfen, PF, [
PF0: (pf0, 0, Input<Floating>),
PF1: (pf1, 1, Input<Floating>),
PF11: (pf11, 11, Input<Floating>),
]);
#[cfg(any(feature = "stm32f030", feature = "stm32f051"))]
gpio!(GPIOF, gpiof, iopfen, PF, [
PF0: (pf0, 0, Input<Floating>),
@ -666,6 +659,21 @@ gpio!(GPIOF, gpiof, iopfen, PF, [
PF7: (pf7, 7, Input<Floating>),
]);
#[cfg(feature = "stm32f038")]
gpio!(GPIOF, gpiof, iopfen, PF, [
PF0: (pf0, 0, Input<Floating>),
PF1: (pf1, 1, Input<Floating>),
PF6: (pf6, 6, Input<Floating>),
PF7: (pf7, 7, Input<Floating>),
]);
#[cfg(feature = "stm32f042")]
gpio!(GPIOF, gpiof, iopfen, PF, [
PF0: (pf0, 0, Input<Floating>),
PF1: (pf1, 1, Input<Floating>),
PF11: (pf11, 11, Input<Floating>),
]);
#[cfg(feature = "stm32f070")]
gpio!(GPIOF, gpiof, iopfen, PF, [
PF0: (pf0, 0, Input<Floating>),

8
src/i2c.rs

@ -36,6 +36,7 @@ macro_rules! i2c_pins {
#[cfg(any(
feature = "stm32f030",
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f051",
feature = "stm32f070",
@ -69,7 +70,12 @@ i2c_pins! {
sda => [gpioa::PA12<Alternate<AF5>>],
}
}
#[cfg(any(feature = "stm32f031", feature = "stm32f042", feature = "stm32f030x6"))]
#[cfg(any(
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f030x6",
))]
i2c_pins! {
I2C1 => {
scl => [gpiob::PB10<Alternate<AF1>>],

3
src/lib.rs

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

3
src/serial.rs

@ -126,7 +126,7 @@ usart_pins! {
rx => [gpioa::PA10<Alternate<AF1>>, gpiob::PB6<Alternate<AF0>>],
}
}
#[cfg(any(feature = "stm32f031", feature = "stm32f030x6"))]
#[cfg(any(feature = "stm32f030x6", feature = "stm32f031", feature = "stm32f038"))]
usart_pins! {
USART1 => {
tx => [gpioa::PA2<Alternate<AF1>>, gpioa::PA14<Alternate<AF1>>],
@ -135,6 +135,7 @@ usart_pins! {
}
#[cfg(any(
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f070",
feature = "stm32f072",
feature = "stm32f091",

2
src/spi.rs

@ -112,7 +112,7 @@ spi_pins! {
mosi => [gpioa::PA7<Alternate<AF0>>, gpiob::PB5<Alternate<AF0>>],
}
}
#[cfg(feature = "stm32f030x6")]
#[cfg(any(feature = "stm32f030x6", feature = "stm32f038"))]
spi_pins! {
SPI1 => {
sck => [gpiob::PB13<Alternate<AF0>>],

1
src/timers.rs

@ -224,6 +224,7 @@ timers! {
#[cfg(any(
feature = "stm32f031",
feature = "stm32f038",
feature = "stm32f042",
feature = "stm32f051",
feature = "stm32f071",

Loading…
Cancel
Save