From 02ca13ab756c5fd21001a54b21ce54feea83d3a4 Mon Sep 17 00:00:00 2001 From: David Sawatzke Date: Tue, 1 Jan 2019 18:33:23 +0100 Subject: [PATCH] Have pin bindings as subsets of families --- src/pin_mappings.rs | 133 ++++++++++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 60 deletions(-) diff --git a/src/pin_mappings.rs b/src/pin_mappings.rs index 0858775..900b8c2 100644 --- a/src/pin_mappings.rs +++ b/src/pin_mappings.rs @@ -52,16 +52,16 @@ pins! { PB9 => {AF1: SdaPin} } -#[cfg(any(feature = "stm32f030", feature = "stm32f042"))] -pins! { - PA11 => {AF5: SclPin}, - PA12 => {AF5: SdaPin} -} - -#[cfg(any(feature = "stm32f030", feature = "stm32f070"))] +#[cfg(feature = "stm32f030")] pins! { PA0 => {AF4: TxPin}, PA1 => {AF4: RxPin}, + PA4 => {AF5: TxPin}, + PA5 => {AF5: RxPin}, + PA11 => {AF5: SclPin}, + PA12 => {AF5: SdaPin}, + PB3 => {AF4: TxPin}, + PB4 => {AF4: RxPin}, PB10 => { AF4: TxPin, AF5: SckPin @@ -79,14 +79,6 @@ pins! { AF0: RxPin, AF1: RxPin } -} - -#[cfg(feature = "stm32f030")] -pins! { - PA4 => {AF5: TxPin}, - PA5 => {AF5: RxPin}, - PB3 => {AF4: TxPin}, - PB4 => {AF4: RxPin}, PC0 => {AF2: TxPin}, PC1 => {AF2: RxPin}, PC12 => {AF2: RxPin}, @@ -97,78 +89,99 @@ pins! { pins! { PA2 => {AF1: TxPin}, PA3 => {AF1: RxPin}, + PA9 => {AF4: SclPin}, + PA10 => {AF4: SdaPin}, PA14 => {AF1: TxPin}, PA15 => {AF1: RxPin}, + PB10 => {AF1: SclPin}, + PB11 => {AF1: SdaPin}, PB13 => {AF0: SckPin}, PB14 => {AF0: MisoPin}, PB15 => {AF0: MosiPin} } -#[cfg(any( - feature = "stm32f030x8", - feature = "stm32f030xc", - feature = "stm32f042", - feature = "stm32f070", -))] +#[cfg(any(feature = "stm32f030x8", feature = "stm32f030xc"))] pins! { PA2 => {AF1: TxPin}, PA3 => {AF1: RxPin}, PA14 => {AF1: TxPin}, - PA15 => {AF1: RxPin} -} -#[cfg(any( - feature = "stm32f030x8", - feature = "stm32f030xc", - feature = "stm32f070xb" -))] -pins! { + PA15 => {AF1: RxPin}, + PB10 => {AF1: SclPin}, + PB11 => {AF1: SdaPin}, PB13 => {AF0: SckPin}, PB14 => {AF0: MisoPin}, PB15 => {AF0: MosiPin} } -#[cfg(any( - feature = "stm32f030x6", - feature = "stm32f030xc", - feature = "stm32f042", - feature = "stm32f070x6" -))] +#[cfg(any(feature = "stm32f030xc",))] pins! { PA9 => {AF4: SclPin}, - PA10 => {AF4: SdaPin} + PA10 => {AF4: SdaPin}, + PB13 => {AF5: SclPin}, + PB14 => {AF5: SdaPin}, + PF0 => {AF1: SdaPin}, + PF1 => {AF1: SclPin} } -#[cfg(any( - feature = "stm32f030x6", - feature = "stm32f042", - feature = "stm32f070xb" -))] +#[cfg(feature = "stm32f042")] pins! { + PA11 => {AF5: SclPin}, + PA12 => {AF5: SdaPin}, + PA2 => {AF1: TxPin}, + PA3 => {AF1: RxPin}, + PA9 => {AF4: SclPin}, + PA10 => {AF4: SdaPin}, + PA14 => {AF1: TxPin}, + PA15 => {AF1: RxPin}, PB10 => {AF1: SclPin}, - PB11 => {AF1: SdaPin} + PB11 => {AF1: SdaPin}, + PB13 => {AF5: SclPin}, + PB14 => {AF5: SdaPin}, + PF0 => {AF1: SdaPin}, + PF1 => {AF1: SclPin} } -#[cfg(any(feature = "stm32f030x8", feature = "stm32f030xc"))] +#[cfg(feature = "stm32f070")] pins! { - PB10 => {AF1: SclPin}, - PB11 => {AF1: SdaPin} -} -#[cfg(any( - feature = "stm32f042", - feature = "stm32f030xc", - feature = "stm32f070x6", -))] -pins! { - PF0 => {AF1: SdaPin} - PF1 => {AF1: SclPin}, + PA0 => {AF4: TxPin}, + PA1 => {AF4: RxPin}, + PA2 => {AF1: TxPin}, + PA3 => {AF1: RxPin}, + PA14 => {AF1: TxPin}, + PA15 => {AF1: RxPin}, + PB10 => { + AF4: TxPin, + AF5: SckPin + }, + PB11 => {AF4: RxPin}, + PC2 => {AF1: MisoPin}, + PC3 => {AF1: MosiPin}, + PC4 => {AF1: TxPin}, + PC5 => {AF1: RxPin}, + PC10 => { + AF0: TxPin, + AF1: TxPin + }, + PC11 => { + AF0: RxPin, + AF1: RxPin + } } -#[cfg(any( - feature = "stm32f042", - feature = "stm32f030xc", - feature = "stm32f070xb" -))] +#[cfg(feature = "stm32f070xb")] pins! { + PB10 => {AF1: SclPin}, + PB11 => {AF1: SdaPin}, + PB13 => {AF0: SckPin}, + PB14 => {AF0: MisoPin}, PB13 => {AF5: SclPin}, - PB14 => {AF5: SdaPin} + PB14 => {AF5: SdaPin}, + PB15 => {AF0: MosiPin} +} +#[cfg(feature = "stm32f070x6")] +pins! { + PA9 => {AF4: SclPin}, + PA10 => {AF4: SdaPin}, + PF0 => {AF1: SdaPin}, + PF1 => {AF1: SclPin} }