Browse Source

Add support for stm32f098

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

3
Cargo.toml

@ -50,7 +50,7 @@ panic-halt = "0.2.0"
device-selected = []
rt = ["stm32f0/rt"]
stm32f030 = ["stm32f0/stm32f0x0", "device-selected"]
stm32f030x4 = ["stm32f030x6"]
stm32f030x4 = ["stm32f030"]
stm32f030x6 = ["stm32f030"]
stm32f030x8 = ["stm32f030"]
stm32f030xc = ["stm32f030"]
@ -67,6 +67,7 @@ stm32f071 = ["stm32f0/stm32f0x1", "device-selected"]
stm32f072 = ["stm32f0/stm32f0x2", "device-selected"]
stm32f078 = ["stm32f0/stm32f0x8", "device-selected"]
stm32f091 = ["stm32f0/stm32f0x1", "device-selected"]
stm32f098 = ["stm32f0/stm32f0x8", "device-selected"]
[profile.dev]
debug = true

4
src/adc.rs

@ -213,6 +213,7 @@ adc_pins!(
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
adc_pins!(
gpioc::PC0<Analog> => 10_u8,
@ -365,6 +366,7 @@ impl VRef {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
#[derive(Debug, Default)]
/// Battery reference voltage (ADC Channel 18)
@ -381,6 +383,7 @@ pub struct VBat;
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
adc_pins!(
VBat => 18_u8,
@ -397,6 +400,7 @@ adc_pins!(
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
impl VBat {
/// Init a new VBat

6
src/gpio.rs

@ -576,6 +576,7 @@ gpio!(GPIOC, gpioc, iopcen, PC, [
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
gpio!(GPIOC, gpioc, iopcen, PC, [
PC0: (pc0, 0, Input<Floating>),
@ -609,7 +610,8 @@ gpio!(GPIOD, gpiod, iopden, PD, [
feature = "stm32f071",
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091"
feature = "stm32f091",
feature = "stm32f098",
))]
gpio!(GPIOD, gpiod, iopden, PD, [
PD0: (pd0, 0, Input<Floating>),
@ -638,6 +640,7 @@ gpio!(GPIOD, gpiod, iopden, PD, [
// feature = "stm32f072",
// feature = "stm32f078",
// feature = "stm32f091",
// feature = "stm32f098",
// ))]
// gpio!(GPIOE, gpioe, iopeen, PE, [
// PE0: (pe0, 0, Input<Floating>),
@ -700,6 +703,7 @@ gpio!(GPIOF, gpiof, iopfen, PF, [
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
gpio!(GPIOF, gpiof, iopfen, PF, [
PF0: (pf0, 0, Input<Floating>),

8
src/i2c.rs

@ -46,6 +46,7 @@ macro_rules! i2c_pins {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
i2c_pins! {
I2C1 => {
@ -60,6 +61,7 @@ i2c_pins! {
feature = "stm32f042",
feature = "stm32f048",
feature = "stm32f091",
feature = "stm32f098",
))]
i2c_pins! {
I2C1 => {
@ -94,7 +96,7 @@ i2c_pins! {
sda => [gpiob::PB14<Alternate<AF5>>],
}
}
#[cfg(any(feature = "stm32f042", feature = "stm32f030xc"))]
#[cfg(any(feature = "stm32f042", feature = "stm32f030xc", feature = "stm32f098"))]
i2c_pins! {
I2C1 => {
scl => [gpiof::PF1<Alternate<AF1>>],
@ -130,6 +132,7 @@ i2c_pins! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
i2c_pins! {
I2C2 => {
@ -137,7 +140,7 @@ i2c_pins! {
sda => [gpiob::PB11<Alternate<AF1>>, gpiob::PB14<Alternate<AF5>>],
}
}
#[cfg(feature = "stm32f091")]
#[cfg(any(feature = "stm32f091", feature = "stm32f098"))]
i2c_pins! {
I2C2 => {
scl => [gpioa::PA11<Alternate<AF5>>],
@ -187,6 +190,7 @@ i2c! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
i2c! {
I2C2: (i2c2, i2c2en, i2c2rst, apb1enr, apb1rstr),

3
src/lib.rs

@ -21,7 +21,8 @@ pub use stm32f0::stm32f0x2 as stm32;
feature = "stm32f038",
feature = "stm32f048",
feature = "stm32f058",
feature = "stm32f078"
feature = "stm32f078",
feature = "stm32f098",
))]
pub use stm32f0::stm32f0x8 as stm32;

15
src/serial.rs

@ -122,6 +122,7 @@ macro_rules! usart_pins {
feature = "stm32f058",
feature = "stm32f071",
feature = "stm32f078",
feature = "stm32f098",
))]
usart_pins! {
USART1 => {
@ -162,6 +163,7 @@ usart_pins! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
usart_pins! {
USART2 => {
@ -173,7 +175,8 @@ usart_pins! {
feature = "stm32f072",
feature = "stm32f071",
feature = "stm32f078",
feature = "stm32f091"
feature = "stm32f091",
feature = "stm32f098",
))]
usart_pins! {
USART2 => {
@ -189,6 +192,7 @@ usart_pins! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
usart_pins! {
USART3 => {
@ -206,6 +210,7 @@ usart_pins! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
usart_pins! {
USART3 => {
@ -224,7 +229,7 @@ usart_pins! {
// }
// }
#[cfg(any(feature = "stm32f030xc", feature = "stm32f091"))]
#[cfg(any(feature = "stm32f030xc", feature = "stm32f091", feature = "stm32f098"))]
usart_pins! {
USART5 => {
tx => [gpiob::PB3<Alternate<AF4>>, gpioc::PC12<Alternate<AF2>>],
@ -237,7 +242,7 @@ usart_pins! {
}
// TODO: The ST SVD files are missing the entire PE enable register.
// Re-enable as soon as this gets fixed.
#[cfg(feature = "stm32f091")]
#[cfg(any(feature = "stm32f091", feature = "stm32f098"))]
usart_pins! {
// USART5 => {
// tx => [gpioe::PE10<Alternate<AF1>>],
@ -391,6 +396,7 @@ usart! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
usart! {
USART2: (usart2, usart2tx, usart2rx,usart2en, apb1enr),
@ -402,12 +408,13 @@ usart! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
usart! {
USART3: (usart3, usart3tx, usart3rx,usart3en, apb1enr),
USART4: (usart4, usart4tx, usart4rx,usart4en, apb1enr),
}
#[cfg(any(feature = "stm32f030xc", feature = "stm32f091"))]
#[cfg(any(feature = "stm32f030xc", feature = "stm32f091", feature = "stm32f098"))]
usart! {
USART5: (usart5, usart5tx, usart5rx,usart5en, apb1enr),
USART6: (usart6, usart6tx, usart6rx,usart6en, apb2enr),

8
src/spi.rs

@ -56,6 +56,7 @@ use crate::stm32::SPI1;
feature = "stm32f071",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
use crate::stm32::SPI2;
@ -130,7 +131,8 @@ spi_pins! {
// feature = "stm32f071",
// feature = "stm32f072",
// feature = "stm32f078",
// feature = "stm32f091"
// feature = "stm32f091",
// feature = "stm32f098",
// ))]
// spi_pins! {
// SPI1 => {
@ -151,6 +153,7 @@ spi_pins! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
spi_pins! {
SPI2 => {
@ -166,6 +169,7 @@ spi_pins! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
spi_pins! {
SPI2 => {
@ -179,6 +183,7 @@ spi_pins! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
spi_pins! {
SPI2 => {
@ -233,6 +238,7 @@ spi! {
feature = "stm32f071",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
spi! {
SPI2: (spi2, spi2en, spi2rst, apb1enr, apb1rstr),

3
src/timers.rs

@ -233,6 +233,7 @@ timers! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
timers! {
TIM2: (tim2, tim2en, tim2rst, apb1enr, apb1rstr),
@ -248,6 +249,7 @@ timers! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
timers! {
TIM6: (tim6, tim6en, tim6rst, apb1enr, apb1rstr),
@ -260,6 +262,7 @@ timers! {
feature = "stm32f072",
feature = "stm32f078",
feature = "stm32f091",
feature = "stm32f098",
))]
timers! {
TIM7: (tim7, tim7en, tim7rst, apb1enr, apb1rstr),

Loading…
Cancel
Save