diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/PeripheralNames.h
similarity index 62%
rename from targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralNames.h
rename to targets/TARGET_Silicon_Labs/TARGET_EFM32/PeripheralNames.h
index 2e5170aef5..840d93cce6 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralNames.h
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/PeripheralNames.h
@@ -31,36 +31,95 @@
extern "C" {
#endif
+#if DEVICE_ANALOGIN
typedef enum {
- ADC_0 = ADC0_BASE
+#ifdef ADC0_BASE
+ ADC_0 = ADC0_BASE,
+#endif
} ADCName;
+#endif
+#if DEVICE_ANALOGOUT
typedef enum {
+#ifdef DAC0_BASE
+ DAC_0 = DAC0_BASE,
+#endif
+} DACName;
+#endif
+
+#if DEVICE_I2C
+typedef enum {
+#ifdef I2C0_BASE
I2C_0 = I2C0_BASE,
+#endif
+#ifdef I2C1_BASE
I2C_1 = I2C1_BASE,
+#endif
} I2CName;
+#endif
+#if DEVICE_PWMOUT
typedef enum {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
PWM_CH0 = 0,
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
PWM_CH1 = 1,
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
PWM_CH2 = 2,
- PWM_CH3 = 3
+#endif
+#if defined(TIMER_ROUTE_CC3PEN) || defined(TIMER_ROUTEPEN_CC3PEN)
+ PWM_CH3 = 3,
+#endif
} PWMName;
+#endif
+#if DEVICE_SPI
typedef enum {
- USART_0 = USART0_BASE,
- USART_1 = USART1_BASE,
- USART_2 = USART2_BASE,
- USART_3 = USART3_BASE,
- LEUART_0 = LEUART0_BASE,
-} UARTName;
-
-typedef enum {
+#ifdef USART0_BASE
SPI_0 = USART0_BASE,
+#endif
+#ifdef USART1_BASE
SPI_1 = USART1_BASE,
+#endif
+#ifdef USART2_BASE
SPI_2 = USART2_BASE,
+#endif
+#ifdef USART3_BASE
SPI_3 = USART3_BASE,
+#endif
} SPIName;
+#endif
+
+#if DEVICE_SERIAL
+typedef enum {
+#ifdef USART0_BASE
+ USART_0 = USART0_BASE,
+#endif
+#ifdef USART1_BASE
+ USART_1 = USART1_BASE,
+#endif
+#ifdef USART2_BASE
+ USART_2 = USART2_BASE,
+#endif
+#ifdef USART3_BASE
+ USART_3 = USART3_BASE,
+#endif
+#ifdef UART0_BASE
+ UART_0 = UART0_BASE,
+#endif
+#ifdef UART1_BASE
+ UART_1 = UART1_BASE,
+#endif
+#ifdef LEUART0_BASE
+ LEUART_0 = LEUART0_BASE,
+#endif
+#ifdef LEUART1_BASE
+ LEUART_1 = LEUART1_BASE,
+#endif
+} UARTName;
+#endif
#ifdef __cplusplus
}
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/PeripheralPins.h
similarity index 90%
rename from targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralPins.h
rename to targets/TARGET_Silicon_Labs/TARGET_EFM32/PeripheralPins.h
index a75e29db71..a2c939804f 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralPins.h
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/PeripheralPins.h
@@ -27,30 +27,40 @@
#include "pinmap.h"
#include "PeripheralNames.h"
+#if DEVICE_ANALOGIN
/************ADC***************/
extern const PinMap PinMap_ADC[];
+#endif
+#if DEVICE_ANALOGOUT
/************DAC***************/
extern const PinMap PinMap_DAC[];
+#endif
-/************I2C SCL***********/
+#if DEVICE_I2C
+/************I2C***************/
extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
extern const PinMap PinMap_I2C_SDA[];
+#endif
+#if DEVICE_PWMOUT
/************PWM***************/
extern const PinMap PinMap_PWM[];
+#endif
+#if DEVICE_SPI
/************SPI***************/
extern const PinMap PinMap_SPI_MOSI[];
extern const PinMap PinMap_SPI_MISO[];
extern const PinMap PinMap_SPI_CLK[];
extern const PinMap PinMap_SPI_CS[];
+#endif
+#if DEVICE_SERIAL
/************UART**************/
extern const PinMap PinMap_UART_TX[];
extern const PinMap PinMap_UART_RX[];
+#endif
#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralNames.h
deleted file mode 100644
index b72166faf0..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralNames.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralNames.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "em_adc.h"
-#include "em_usart.h"
-#include "em_i2c.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- DAC_0 = DAC0_BASE
-} DACName;
-
-typedef enum {
- ADC_0 = ADC0_BASE
-} ADCName;
-
-typedef enum {
- I2C_0 = I2C0_BASE,
- I2C_1 = I2C1_BASE
-} I2CName;
-
-typedef enum {
- PWM_CH0 = 0,
- PWM_CH1 = 1,
- PWM_CH2 = 2,
-} PWMName;
-
-typedef enum {
- UART_0 = UART0_BASE,
- UART_1 = UART1_BASE,
- USART_0 = USART0_BASE,
- USART_1 = USART1_BASE,
- USART_2 = USART2_BASE,
- LEUART_0 = LEUART0_BASE,
- LEUART_1 = LEUART1_BASE
-} UARTName;
-
-typedef enum {
- SPI_0 = USART0_BASE,
- SPI_1 = USART1_BASE,
- SPI_2 = USART2_BASE
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralPins.c
index 9a0d3708f5..6240140178 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralPins.c
@@ -26,6 +26,7 @@
/************ADC***************/
/* The third "function" value is used to select the correct ADC channel */
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PD0, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH0},
{PD1, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH1},
{PD2, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH2},
@@ -34,18 +35,22 @@ const PinMap PinMap_ADC[] = {
{PD5, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH5},
{PD6, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH6},
{PD7, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH7},
+#endif
{NC , NC , NC}
};
/************DAC***************/
const PinMap PinMap_DAC[] = {
+#ifdef DAC0_BASE
{PB11, DAC_0, 0},
{PB12, DAC_0, 1},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PD7, I2C_0, 1},
@@ -54,18 +59,20 @@ const PinMap PinMap_I2C_SCL[] = {
{PC1, I2C_0, 4},
{PF1, I2C_0, 5},
{PE13, I2C_0, 6},
-
+#endif
+#ifdef I2C1_BASE
/* I2C1 */
{PC5, I2C_1, 0},
{PB12, I2C_1, 1},
{PE1, I2C_1, 2},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PD6, I2C_0, 1},
@@ -74,160 +81,222 @@ const PinMap PinMap_I2C_SDA[] = {
{PC0, I2C_0, 4},
{PF0, I2C_0, 5},
{PE12, I2C_0, 6},
-
+#endif
+#ifdef I2C1_BASE
/* I2C1 */
{PC4, I2C_1, 0},
{PB11, I2C_1, 1},
{PE0, I2C_1, 2},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA8, PWM_CH0, 0},
- {PA9, PWM_CH1, 0},
- {PA10, PWM_CH2, 0},
{PA12, PWM_CH0, 1},
- {PA13, PWM_CH1, 1},
- {PA14, PWM_CH2, 1},
{PC8, PWM_CH0, 2},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
+ {PA9, PWM_CH1, 0},
+ {PA13, PWM_CH1, 1},
{PC9, PWM_CH1, 2},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
+ {PA10, PWM_CH2, 0},
+ {PA14, PWM_CH2, 1},
{PC10, PWM_CH2, 2},
+#endif
{NC , NC , 0}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE10, SPI_0, 0},
{PE7, SPI_0, 1},
{PC11, SPI_0, 2},
{PC0, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD0, SPI_1, 1},
{PD7, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC2, SPI_2, 0},
{PB3, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE11, SPI_0, 0},
{PE6, SPI_0, 1},
{PC10, SPI_0, 2},
{PC1, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD1, SPI_1, 1},
{PD6, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC3, SPI_2, 0},
{PB4, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE12, SPI_0, 0},
{PE5, SPI_0, 1},
{PC9, SPI_0, 2},
{PB13, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD2, SPI_1, 1},
{PF0, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC4, SPI_2, 0},
{PB5, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE13, SPI_0, 0},
{PE4, SPI_0, 1},
{PC8, SPI_0, 2},
{PB14, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD3, SPI_1, 1},
{PF1, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC5, SPI_2, 0},
{PB6, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef UART0_BASE
/* UART0 */
{PF6, UART_0, 0},
{PE0, UART_0, 1},
+#endif
+#ifdef UART1_BASE
/* UART1 */
{PF10, UART_1, 1},
{PB9, UART_1, 2},
{PE2, UART_1, 3},
+#endif
+#ifdef USART0_BASE
/* USART0 */
{PE10, USART_0, 0},
{PE7, USART_0, 1},
{PC11, USART_0, 2},
{PE13, USART_0, 3},
{PB7, USART_0, 4},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC0, USART_1, 0},
{PD0, USART_1, 1},
{PD7, USART_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC2, USART_2, 0},
{PB3, USART_2, 1},
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD4, LEUART_0, 0},
{PB13, LEUART_0, 1},
{PE14, LEUART_0, 2},
{PF0, LEUART_0, 3},
{PF2, LEUART_0, 4},
+#endif
+#ifdef LEUART1_BASE
/* LEUART1 */
{PC6, LEUART_1, 0},
{PA5, LEUART_1, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef UART0_BASE
/* UART0 */
{PF7, UART_0, 0},
{PE1, UART_0, 1},
+#endif
+#ifdef UART1_BASE
/* UART1 */
{PF11, UART_1, 1},
{PB10, UART_1, 2},
{PE3, UART_1, 3},
+#endif
+#ifdef USART0_BASE
/* USART0 */
{PE11, USART_0, 0},
{PE6, USART_0, 1},
{PC10, USART_0, 2},
{PE12, USART_0, 3},
{PB8, USART_0, 4},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC1, USART_1, 0},
{PD1, USART_1, 1},
{PD6, USART_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC3, USART_2, 0},
{PB4, USART_2, 1},
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD5, LEUART_0, 0},
{PB14, LEUART_0, 1},
{PE15, LEUART_0, 2},
{PF1, LEUART_0, 3},
{PA0, LEUART_0, 4},
+#endif
+#ifdef LEUART1_BASE
/* LEUART1 */
{PC7, LEUART_1, 0},
{PA6, LEUART_1, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralPins.h
deleted file mode 100644
index a75e29db71..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralPins.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralPins.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************ADC***************/
-extern const PinMap PinMap_ADC[];
-
-/************DAC***************/
-extern const PinMap PinMap_DAC[];
-
-/************I2C SCL***********/
-extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
-extern const PinMap PinMap_I2C_SDA[];
-
-/************PWM***************/
-extern const PinMap PinMap_PWM[];
-
-/************SPI***************/
-extern const PinMap PinMap_SPI_MOSI[];
-extern const PinMap PinMap_SPI_MISO[];
-extern const PinMap PinMap_SPI_CLK[];
-extern const PinMap PinMap_SPI_CS[];
-
-/************UART**************/
-extern const PinMap PinMap_UART_TX[];
-extern const PinMap PinMap_UART_RX[];
-
-#endif
-
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralNames.h
deleted file mode 100644
index d28b6bc39b..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralNames.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralNames.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "em_adc.h"
-#include "em_usart.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- ADC_0 = ADC0_BASE
-} ADCName;
-
-typedef enum {
- I2C_0 = I2C0_BASE
-} I2CName;
-
-typedef enum {
- PWM_CH0 = 0,
- PWM_CH1 = 1,
- PWM_CH2 = 2,
-} PWMName;
-
-typedef enum {
- USART_0 = USART0_BASE,
- USART_1 = USART1_BASE,
- LEUART_0 = LEUART0_BASE
-} UARTName;
-
-typedef enum {
- SPI_0 = USART0_BASE,
- SPI_1 = USART1_BASE
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralPins.c
index 4f1712296f..189c82439e 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralPins.c
@@ -25,154 +25,181 @@
/************ADC***************/
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PD4, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH4},
{PD5, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH5},
{PD6, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH6},
{PD7, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH7},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PD7, I2C_0, 1},
{PC1, I2C_0, 4},
{PF1, I2C_0, 5},
{PE13, I2C_0, 6},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PD6, I2C_0, 1},
{PC0, I2C_0, 4},
{PF0, I2C_0, 5},
{PE12, I2C_0, 6},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA0, PWM_CH0, 0},
- {PA1, PWM_CH1, 0},
- {PA2, PWM_CH2, 0},
{PF0, PWM_CH0, 5},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
+ {PA1, PWM_CH1, 0},
{PF1, PWM_CH1, 5},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
+ {PA2, PWM_CH2, 0},
{PF2, PWM_CH2, 5},
+#endif
{NC , NC , NC}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE10, SPI_0, 0},
//{NC, SPI_0, 2}, /* SPI_0 loc2 is not bonded */
{PE13, SPI_0, 3},
{PB7, SPI_0, 4},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC0, SPI_1, 0},
{PD7, SPI_1, 3},
{PF2, SPI_1, 4},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE11, SPI_0, 0},
{PC10, SPI_0, 2},
{PE12, SPI_0, 3},
{PB8, SPI_0, 4},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC1, SPI_1, 0},
{PD6, SPI_1, 3},
{PA0, SPI_1, 4},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE12, SPI_0, 0},
{PC9, SPI_0, 2},
//{PC15, SPI_0, 3}, /* Conflict with SPI_0 loc4 */
{PB13, SPI_0, 4},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PB7, SPI_1, 0},
{PC15, SPI_1, 3},
{PB11, SPI_1, 4},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE13, SPI_0, 0},
{PC8, SPI_0, 2},
//{PC14, SPI_0, 3}, /* Conflict with SPI_1 loc3 */
{PB14, SPI_0, 4},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PB8, SPI_1, 0},
{PC14, SPI_1, 3},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE10, USART_0, 0},
//{NC, USART_0, 2}, /* USART_0 loc2 is not bonded */
{PE13, USART_0, 3},
{PB7, USART_0, 4},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC0, USART_1, 0},
{PD7, USART_1, 3},
{PF2, USART_1, 4},
-
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD4, LEUART_0, 0},
{PB13, LEUART_0, 1},
{PF0, LEUART_0, 3},
{PC14, LEUART_0, 5},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE11, USART_0, 0},
//{PC10, USART_0, 2},
{PE12, USART_0, 3},
{PB8, USART_0, 4},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC1, USART_1, 0},
{PD6, USART_1, 3},
{PA0, USART_1, 4},
-
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD5, LEUART_0, 0},
{PB14, LEUART_0, 1},
{PF1, LEUART_0, 3},
{PC15, LEUART_0, 5},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralPins.h
deleted file mode 100644
index a19c09da7a..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralPins.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralPins.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************ADC***************/
-extern const PinMap PinMap_ADC[];
-
-/************I2C SCL***********/
-extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
-extern const PinMap PinMap_I2C_SDA[];
-
-/************PWM***************/
-extern const PinMap PinMap_PWM[];
-
-/************SPI***************/
-extern const PinMap PinMap_SPI_MOSI[];
-extern const PinMap PinMap_SPI_MISO[];
-extern const PinMap PinMap_SPI_CLK[];
-extern const PinMap PinMap_SPI_CS[];
-
-/************UART**************/
-extern const PinMap PinMap_UART_TX[];
-extern const PinMap PinMap_UART_RX[];
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralNames.h
deleted file mode 100644
index b72166faf0..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralNames.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralNames.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "em_adc.h"
-#include "em_usart.h"
-#include "em_i2c.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- DAC_0 = DAC0_BASE
-} DACName;
-
-typedef enum {
- ADC_0 = ADC0_BASE
-} ADCName;
-
-typedef enum {
- I2C_0 = I2C0_BASE,
- I2C_1 = I2C1_BASE
-} I2CName;
-
-typedef enum {
- PWM_CH0 = 0,
- PWM_CH1 = 1,
- PWM_CH2 = 2,
-} PWMName;
-
-typedef enum {
- UART_0 = UART0_BASE,
- UART_1 = UART1_BASE,
- USART_0 = USART0_BASE,
- USART_1 = USART1_BASE,
- USART_2 = USART2_BASE,
- LEUART_0 = LEUART0_BASE,
- LEUART_1 = LEUART1_BASE
-} UARTName;
-
-typedef enum {
- SPI_0 = USART0_BASE,
- SPI_1 = USART1_BASE,
- SPI_2 = USART2_BASE
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralPins.c
index 9a0d3708f5..6240140178 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralPins.c
@@ -26,6 +26,7 @@
/************ADC***************/
/* The third "function" value is used to select the correct ADC channel */
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PD0, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH0},
{PD1, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH1},
{PD2, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH2},
@@ -34,18 +35,22 @@ const PinMap PinMap_ADC[] = {
{PD5, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH5},
{PD6, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH6},
{PD7, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH7},
+#endif
{NC , NC , NC}
};
/************DAC***************/
const PinMap PinMap_DAC[] = {
+#ifdef DAC0_BASE
{PB11, DAC_0, 0},
{PB12, DAC_0, 1},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PD7, I2C_0, 1},
@@ -54,18 +59,20 @@ const PinMap PinMap_I2C_SCL[] = {
{PC1, I2C_0, 4},
{PF1, I2C_0, 5},
{PE13, I2C_0, 6},
-
+#endif
+#ifdef I2C1_BASE
/* I2C1 */
{PC5, I2C_1, 0},
{PB12, I2C_1, 1},
{PE1, I2C_1, 2},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PD6, I2C_0, 1},
@@ -74,160 +81,222 @@ const PinMap PinMap_I2C_SDA[] = {
{PC0, I2C_0, 4},
{PF0, I2C_0, 5},
{PE12, I2C_0, 6},
-
+#endif
+#ifdef I2C1_BASE
/* I2C1 */
{PC4, I2C_1, 0},
{PB11, I2C_1, 1},
{PE0, I2C_1, 2},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA8, PWM_CH0, 0},
- {PA9, PWM_CH1, 0},
- {PA10, PWM_CH2, 0},
{PA12, PWM_CH0, 1},
- {PA13, PWM_CH1, 1},
- {PA14, PWM_CH2, 1},
{PC8, PWM_CH0, 2},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
+ {PA9, PWM_CH1, 0},
+ {PA13, PWM_CH1, 1},
{PC9, PWM_CH1, 2},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
+ {PA10, PWM_CH2, 0},
+ {PA14, PWM_CH2, 1},
{PC10, PWM_CH2, 2},
+#endif
{NC , NC , 0}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE10, SPI_0, 0},
{PE7, SPI_0, 1},
{PC11, SPI_0, 2},
{PC0, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD0, SPI_1, 1},
{PD7, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC2, SPI_2, 0},
{PB3, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE11, SPI_0, 0},
{PE6, SPI_0, 1},
{PC10, SPI_0, 2},
{PC1, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD1, SPI_1, 1},
{PD6, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC3, SPI_2, 0},
{PB4, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE12, SPI_0, 0},
{PE5, SPI_0, 1},
{PC9, SPI_0, 2},
{PB13, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD2, SPI_1, 1},
{PF0, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC4, SPI_2, 0},
{PB5, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE13, SPI_0, 0},
{PE4, SPI_0, 1},
{PC8, SPI_0, 2},
{PB14, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD3, SPI_1, 1},
{PF1, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC5, SPI_2, 0},
{PB6, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef UART0_BASE
/* UART0 */
{PF6, UART_0, 0},
{PE0, UART_0, 1},
+#endif
+#ifdef UART1_BASE
/* UART1 */
{PF10, UART_1, 1},
{PB9, UART_1, 2},
{PE2, UART_1, 3},
+#endif
+#ifdef USART0_BASE
/* USART0 */
{PE10, USART_0, 0},
{PE7, USART_0, 1},
{PC11, USART_0, 2},
{PE13, USART_0, 3},
{PB7, USART_0, 4},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC0, USART_1, 0},
{PD0, USART_1, 1},
{PD7, USART_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC2, USART_2, 0},
{PB3, USART_2, 1},
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD4, LEUART_0, 0},
{PB13, LEUART_0, 1},
{PE14, LEUART_0, 2},
{PF0, LEUART_0, 3},
{PF2, LEUART_0, 4},
+#endif
+#ifdef LEUART1_BASE
/* LEUART1 */
{PC6, LEUART_1, 0},
{PA5, LEUART_1, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef UART0_BASE
/* UART0 */
{PF7, UART_0, 0},
{PE1, UART_0, 1},
+#endif
+#ifdef UART1_BASE
/* UART1 */
{PF11, UART_1, 1},
{PB10, UART_1, 2},
{PE3, UART_1, 3},
+#endif
+#ifdef USART0_BASE
/* USART0 */
{PE11, USART_0, 0},
{PE6, USART_0, 1},
{PC10, USART_0, 2},
{PE12, USART_0, 3},
{PB8, USART_0, 4},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC1, USART_1, 0},
{PD1, USART_1, 1},
{PD6, USART_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC3, USART_2, 0},
{PB4, USART_2, 1},
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD5, LEUART_0, 0},
{PB14, LEUART_0, 1},
{PE15, LEUART_0, 2},
{PF1, LEUART_0, 3},
{PA0, LEUART_0, 4},
+#endif
+#ifdef LEUART1_BASE
/* LEUART1 */
{PC7, LEUART_1, 0},
{PA6, LEUART_1, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralNames.h
deleted file mode 100644
index 813fd47e85..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralNames.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralNames.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "em_adc.h"
-#include "em_usart.h"
-#include "em_i2c.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- ADC_0 = ADC0_BASE
-} ADCName;
-
-typedef enum {
- I2C_0 = I2C0_BASE,
-} I2CName;
-
-typedef enum {
- PWM_CH0 = 0,
- PWM_CH1 = 1,
- PWM_CH2 = 2,
- PWM_CH3 = 3
-} PWMName;
-
-typedef enum {
- USART_0 = USART0_BASE,
- USART_1 = USART1_BASE,
- LEUART_0 = LEUART0_BASE,
-} UARTName;
-
-typedef enum {
- SPI_0 = USART0_BASE,
- SPI_1 = USART1_BASE,
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralPins.c
index 95baad0840..6810372249 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralPins.c
@@ -26,6 +26,7 @@
/************ADC***************/
/* The third "function" value is used to select the correct ADC channel */
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PA0, ADC_0, adcPosSelAPORT3XCH8},
{PA1, ADC_0, adcPosSelAPORT4XCH9},
{PA2, ADC_0, adcPosSelAPORT3XCH10},
@@ -61,11 +62,13 @@ const PinMap PinMap_ADC[] = {
{PF5, ADC_0, adcPosSelAPORT2XCH21},
{PF6, ADC_0, adcPosSelAPORT1XCH22},
{PF7, ADC_0, adcPosSelAPORT2XCH23},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PA2, I2C_0, 1},
@@ -99,12 +102,13 @@ const PinMap PinMap_I2C_SCL[] = {
{PF6, I2C_0, 29},
{PF7, I2C_0, 30},
{PA0, I2C_0, 31},
-
+#endif
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PA1, I2C_0, 1},
@@ -138,52 +142,63 @@ const PinMap PinMap_I2C_SDA[] = {
{PF5, I2C_0, 29},
{PF6, I2C_0, 30},
{PF7, I2C_0, 31},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA0, PWM_CH0, 0},
- {PA1, PWM_CH1, 0},
- {PA2, PWM_CH2, 0},
- {PA3, PWM_CH3, 0},
- {PA4, PWM_CH2, 2},
- {PA5, PWM_CH3, 2},
- {PB11, PWM_CH1, 5},
- {PB12, PWM_CH2, 5},
- {PB13, PWM_CH3, 5},
{PB14, PWM_CH0, 9},
{PB15, PWM_CH0, 10},
{PC6, PWM_CH0, 11},
+ {PD10, PWM_CH0, 18},
+ {PD14, PWM_CH0, 22},
+ {PF0, PWM_CH0, 24},
+ {PF4, PWM_CH0, 28},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
+ {PA1, PWM_CH1, 0},
+ {PB11, PWM_CH1, 5},
{PC7, PWM_CH1, 11},
+ {PD11, PWM_CH1, 18},
+ {PD15, PWM_CH1, 22},
+ {PF1, PWM_CH1, 24},
+ {PF5, PWM_CH1, 28},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
+ {PA2, PWM_CH2, 0},
+ {PA4, PWM_CH2, 2},
+ {PB12, PWM_CH2, 5},
{PC8, PWM_CH2, 11},
+ {PD12, PWM_CH2, 18},
+ {PF2, PWM_CH2, 24},
+ {PF6, PWM_CH2, 28},
+#endif
+#if defined(TIMER_ROUTE_CC3PEN) || defined(TIMER_ROUTEPEN_CC3PEN)
+ /* PWM3 */
+ {PA3, PWM_CH3, 0},
+ {PA5, PWM_CH3, 2},
+ {PB13, PWM_CH3, 5},
{PC9, PWM_CH3, 11},
{PC10, PWM_CH2, 13},
{PC11, PWM_CH3, 13},
{PD9, PWM_CH3, 14},
- {PD10, PWM_CH0, 18},
- {PD11, PWM_CH1, 18},
- {PD12, PWM_CH2, 18},
{PD13, PWM_CH3, 18},
- {PD14, PWM_CH0, 22},
- {PD15, PWM_CH1, 22},
- {PF0, PWM_CH0, 24},
- {PF1, PWM_CH1, 24},
- {PF2, PWM_CH2, 24},
{PF3, PWM_CH3, 24},
- {PF4, PWM_CH0, 28},
- {PF5, PWM_CH1, 28},
- {PF6, PWM_CH2, 28},
{PF7, PWM_CH3, 28},
-
+#endif
{NC , NC , NC}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 0},
{PA1, SPI_0, 1},
@@ -203,7 +218,8 @@ const PinMap PinMap_SPI_MOSI[] = {
{PD13, SPI_0, 21},
{PD14, SPI_0, 22},
{PD15, SPI_0, 23},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 11},
{PC7, SPI_1, 12},
@@ -219,12 +235,12 @@ const PinMap PinMap_SPI_MOSI[] = {
{PF5, SPI_1, 29},
{PF6, SPI_1, 30},
{PF7, SPI_1, 31},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 31},
{PA1, SPI_0, 0},
@@ -244,7 +260,8 @@ const PinMap PinMap_SPI_MISO[] = {
{PD13, SPI_0, 20},
{PD14, SPI_0, 21},
{PD15, SPI_0, 22},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 10},
{PC7, SPI_1, 11},
@@ -261,12 +278,12 @@ const PinMap PinMap_SPI_MISO[] = {
{PF6, SPI_1, 29},
{PF7, SPI_1, 30},
{PA0, SPI_1, 31},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 30},
{PA1, SPI_0, 31},
@@ -286,7 +303,8 @@ const PinMap PinMap_SPI_CLK[] = {
{PD13, SPI_0, 19},
{PD14, SPI_0, 20},
{PD15, SPI_0, 21},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 9},
{PC7, SPI_1, 10},
@@ -304,12 +322,12 @@ const PinMap PinMap_SPI_CLK[] = {
{PF7, SPI_1, 29},
{PA0, SPI_1, 30},
{PA1, SPI_1, 31},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 29},
{PA1, SPI_0, 30},
@@ -329,7 +347,8 @@ const PinMap PinMap_SPI_CS[] = {
{PD13, SPI_0, 18},
{PD14, SPI_0, 19},
{PD15, SPI_0, 20},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 8},
{PC7, SPI_1, 9},
@@ -345,12 +364,14 @@ const PinMap PinMap_SPI_CS[] = {
{PF5, SPI_1, 26},
{PF6, SPI_1, 27},
{PF7, SPI_1, 28},
-
+#endif
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef USART0_BASE
+ /* USART0 */
{PA0, USART_0, 0},
{PA1, USART_0, 1},
{PA2, USART_0, 2},
@@ -362,6 +383,9 @@ const PinMap PinMap_UART_TX[] = {
{PB13, USART_0, 8},
{PB14, USART_0, 9},
{PB15, USART_0, 10},
+#endif
+#ifdef LEUART0_BASE
+ /* LEUART0 */
{PD9, LEUART_0, 17},
{PD10, LEUART_0, 18},
{PD11, LEUART_0, 19},
@@ -369,7 +393,9 @@ const PinMap PinMap_UART_TX[] = {
{PD13, LEUART_0, 21},
{PD14, LEUART_0, 22},
{PD15, LEUART_0, 23},
-
+#endif
+#ifdef USART1_BASE
+ /* USART1 */
{PC6, USART_1, 11},
{PC7, USART_1, 12},
{PC8, USART_1, 13},
@@ -384,11 +410,13 @@ const PinMap PinMap_UART_TX[] = {
{PF5, USART_1, 29},
{PF6, USART_1, 30},
{PF7, USART_1, 31},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef USART0_BASE
+ /* USART0 */
{PA0, USART_0, 31},
{PA1, USART_0, 0},
{PA2, USART_0, 1},
@@ -400,6 +428,9 @@ const PinMap PinMap_UART_RX[] = {
{PB13, USART_0, 7},
{PB14, USART_0, 8},
{PB15, USART_0, 9},
+#endif
+#ifdef LEUART0_BASE
+ /* LEUART0 */
{PD9, LEUART_0, 16},
{PD10, LEUART_0, 17},
{PD11, LEUART_0, 18},
@@ -407,7 +438,9 @@ const PinMap PinMap_UART_RX[] = {
{PD13, LEUART_0, 20},
{PD14, LEUART_0, 21},
{PD15, LEUART_0, 22},
-
+#endif
+#ifdef USART1_BASE
+ /* USART1 */
{PC6, USART_1, 10},
{PC7, USART_1, 11},
{PC8, USART_1, 12},
@@ -422,6 +455,6 @@ const PinMap PinMap_UART_RX[] = {
{PF5, USART_1, 28},
{PF6, USART_1, 29},
{PF7, USART_1, 30},
-
+#endif
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralPins.h
deleted file mode 100644
index 79d6072e83..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/PeripheralPins.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralPins.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************ADC***************/
-extern const PinMap PinMap_ADC[];
-
-/************I2C SCL***********/
-extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
-extern const PinMap PinMap_I2C_SDA[];
-
-/************PWM***************/
-extern const PinMap PinMap_PWM[];
-
-/************SPI***************/
-extern const PinMap PinMap_SPI_MOSI[];
-extern const PinMap PinMap_SPI_MISO[];
-extern const PinMap PinMap_SPI_CLK[];
-extern const PinMap PinMap_SPI_CS[];
-
-/************UART**************/
-extern const PinMap PinMap_UART_TX[];
-extern const PinMap PinMap_UART_RX[];
-
-#endif
-
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralNames.h
deleted file mode 100644
index 2e5170aef5..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralNames.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralNames.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "em_adc.h"
-#include "em_usart.h"
-#include "em_i2c.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- ADC_0 = ADC0_BASE
-} ADCName;
-
-typedef enum {
- I2C_0 = I2C0_BASE,
- I2C_1 = I2C1_BASE,
-} I2CName;
-
-typedef enum {
- PWM_CH0 = 0,
- PWM_CH1 = 1,
- PWM_CH2 = 2,
- PWM_CH3 = 3
-} PWMName;
-
-typedef enum {
- USART_0 = USART0_BASE,
- USART_1 = USART1_BASE,
- USART_2 = USART2_BASE,
- USART_3 = USART3_BASE,
- LEUART_0 = LEUART0_BASE,
-} UARTName;
-
-typedef enum {
- SPI_0 = USART0_BASE,
- SPI_1 = USART1_BASE,
- SPI_2 = USART2_BASE,
- SPI_3 = USART3_BASE,
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralPins.c
index 79f7f1933e..7fe5c45a30 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralPins.c
@@ -26,6 +26,7 @@
/************ADC***************/
/* The third "function" value is used to select the correct ADC channel */
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PA0, ADC_0, adcPosSelAPORT3XCH8},
{PA1, ADC_0, adcPosSelAPORT4XCH9},
{PA2, ADC_0, adcPosSelAPORT3XCH10},
@@ -61,11 +62,13 @@ const PinMap PinMap_ADC[] = {
{PF5, ADC_0, adcPosSelAPORT2XCH21},
{PF6, ADC_0, adcPosSelAPORT1XCH22},
{PF7, ADC_0, adcPosSelAPORT2XCH23},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PA2, I2C_0, 1},
@@ -99,7 +102,8 @@ const PinMap PinMap_I2C_SCL[] = {
{PF6, I2C_0, 29},
{PF7, I2C_0, 30},
{PA0, I2C_0, 31},
-
+#endif
+#ifdef I2C1_BASE
{PA7, I2C_1, 0},
{PA8, I2C_1, 1},
{PA9, I2C_1, 2},
@@ -130,12 +134,13 @@ const PinMap PinMap_I2C_SCL[] = {
{PK1, I2C_1, 29},
{PK2, I2C_1, 30},
{PA6, I2C_1, 31},
-
+#endif
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PA1, I2C_0, 1},
@@ -169,7 +174,8 @@ const PinMap PinMap_I2C_SDA[] = {
{PF5, I2C_0, 29},
{PF6, I2C_0, 30},
{PF7, I2C_0, 31},
-
+#endif
+#ifdef I2C1_BASE
{PA6, I2C_1, 0},
{PA7, I2C_1, 1},
{PA8, I2C_1, 2},
@@ -200,53 +206,63 @@ const PinMap PinMap_I2C_SDA[] = {
{PK0, I2C_1, 29},
{PK1, I2C_1, 30},
{PK2, I2C_1, 31},
-
+#endif
/* Not connected */
-
{NC , NC , NC}
};
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA0, PWM_CH0, 0},
- {PA1, PWM_CH1, 0},
- {PA2, PWM_CH2, 0},
- {PA3, PWM_CH3, 0},
- {PA4, PWM_CH2, 2},
- {PA5, PWM_CH3, 2},
- {PB11, PWM_CH1, 5},
- {PB12, PWM_CH2, 5},
- {PB13, PWM_CH3, 5},
{PB14, PWM_CH0, 9},
{PB15, PWM_CH0, 10},
{PC6, PWM_CH0, 11},
+ {PD10, PWM_CH0, 18},
+ {PD14, PWM_CH0, 22},
+ {PF0, PWM_CH0, 24},
+ {PF4, PWM_CH0, 28},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
+ {PA1, PWM_CH1, 0},
+ {PB11, PWM_CH1, 5},
{PC7, PWM_CH1, 11},
+ {PD11, PWM_CH1, 18},
+ {PD15, PWM_CH1, 22},
+ {PF1, PWM_CH1, 24},
+ {PF5, PWM_CH1, 28},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
+ {PA2, PWM_CH2, 0},
+ {PA4, PWM_CH2, 2},
+ {PB12, PWM_CH2, 5},
{PC8, PWM_CH2, 11},
- {PC9, PWM_CH3, 11},
{PC10, PWM_CH2, 13},
+ {PD12, PWM_CH2, 18},
+ {PF2, PWM_CH2, 24},
+ {PF6, PWM_CH2, 28},
+#endif
+#if defined(TIMER_ROUTE_CC3PEN) || defined(TIMER_ROUTEPEN_CC3PEN)
+ /* PWM3 */
+ {PA3, PWM_CH3, 0},
+ {PA5, PWM_CH3, 2},
+ {PB13, PWM_CH3, 5},
+ {PC9, PWM_CH3, 11},
{PC11, PWM_CH3, 13},
{PD9, PWM_CH3, 14},
- {PD10, PWM_CH0, 18},
- {PD11, PWM_CH1, 18},
- {PD12, PWM_CH2, 18},
{PD13, PWM_CH3, 18},
- {PD14, PWM_CH0, 22},
- {PD15, PWM_CH1, 22},
- {PF0, PWM_CH0, 24},
- {PF1, PWM_CH1, 24},
- {PF2, PWM_CH2, 24},
{PF3, PWM_CH3, 24},
- {PF4, PWM_CH0, 28},
- {PF5, PWM_CH1, 28},
- {PF6, PWM_CH2, 28},
{PF7, PWM_CH3, 28},
-
+#endif
{NC , NC , NC}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 0},
{PA1, SPI_0, 1},
@@ -266,7 +282,8 @@ const PinMap PinMap_SPI_MOSI[] = {
{PD13, SPI_0, 21},
{PD14, SPI_0, 22},
{PD15, SPI_0, 23},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 11},
{PC7, SPI_1, 12},
@@ -282,7 +299,8 @@ const PinMap PinMap_SPI_MOSI[] = {
{PF5, SPI_1, 29},
{PF6, SPI_1, 30},
{PF7, SPI_1, 31},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA6, SPI_2, 1},
{PA7, SPI_2, 2},
@@ -308,7 +326,8 @@ const PinMap PinMap_SPI_MOSI[] = {
{PK0, SPI_2, 29},
{PK1, SPI_2, 30},
{PK2, SPI_2, 31},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, SPI_3, 16},
{PJ15, SPI_3, 17},
@@ -318,12 +337,12 @@ const PinMap PinMap_SPI_MOSI[] = {
{PC3, SPI_3, 21},
{PC4, SPI_3, 22},
{PC5, SPI_3, 23},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 31},
{PA1, SPI_0, 0},
@@ -343,7 +362,8 @@ const PinMap PinMap_SPI_MISO[] = {
{PD13, SPI_0, 20},
{PD14, SPI_0, 21},
{PD15, SPI_0, 22},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 10},
{PC7, SPI_1, 11},
@@ -360,7 +380,8 @@ const PinMap PinMap_SPI_MISO[] = {
{PF6, SPI_1, 29},
{PF7, SPI_1, 30},
{PA0, SPI_1, 31},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA6, SPI_2, 0},
{PA7, SPI_2, 1},
@@ -386,7 +407,8 @@ const PinMap PinMap_SPI_MISO[] = {
{PK0, SPI_2, 28},
{PK1, SPI_2, 29},
{PK2, SPI_2, 30},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, SPI_3, 15},
{PJ15, SPI_3, 16},
@@ -396,12 +418,12 @@ const PinMap PinMap_SPI_MISO[] = {
{PC3, SPI_3, 20},
{PC4, SPI_3, 21},
{PC5, SPI_3, 22},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 30},
{PA1, SPI_0, 31},
@@ -421,7 +443,8 @@ const PinMap PinMap_SPI_CLK[] = {
{PD13, SPI_0, 19},
{PD14, SPI_0, 20},
{PD15, SPI_0, 21},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 9},
{PC7, SPI_1, 10},
@@ -439,7 +462,8 @@ const PinMap PinMap_SPI_CLK[] = {
{PF7, SPI_1, 29},
{PA0, SPI_1, 30},
{PA1, SPI_1, 31},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA7, SPI_2, 0},
{PA8, SPI_2, 1},
@@ -465,7 +489,8 @@ const PinMap PinMap_SPI_CLK[] = {
{PK1, SPI_2, 28},
{PK2, SPI_2, 29},
{PA6, SPI_2, 31},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, SPI_3, 14},
{PJ15, SPI_3, 15},
@@ -475,12 +500,12 @@ const PinMap PinMap_SPI_CLK[] = {
{PC3, SPI_3, 19},
{PC4, SPI_3, 20},
{PC5, SPI_3, 21},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 29},
{PA1, SPI_0, 30},
@@ -500,7 +525,8 @@ const PinMap PinMap_SPI_CS[] = {
{PD13, SPI_0, 18},
{PD14, SPI_0, 19},
{PD15, SPI_0, 20},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 8},
{PC7, SPI_1, 9},
@@ -516,7 +542,8 @@ const PinMap PinMap_SPI_CS[] = {
{PF5, SPI_1, 26},
{PF6, SPI_1, 27},
{PF7, SPI_1, 28},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA8, SPI_2, 0},
{PA9, SPI_2, 1},
@@ -542,7 +569,8 @@ const PinMap PinMap_SPI_CS[] = {
{PK2, SPI_2, 28},
{PA6, SPI_2, 30},
{PA7, SPI_2, 31},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, SPI_3, 13},
{PJ15, SPI_3, 14},
@@ -552,12 +580,14 @@ const PinMap PinMap_SPI_CS[] = {
{PC3, SPI_3, 18},
{PC4, SPI_3, 19},
{PC5, SPI_3, 20},
-
+#endif
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef USART0_BASE
+ /* USART0 */
{PA0, USART_0, 0},
{PA1, USART_0, 1},
{PA2, USART_0, 2},
@@ -569,6 +599,9 @@ const PinMap PinMap_UART_TX[] = {
{PB13, USART_0, 8},
{PB14, USART_0, 9},
{PB15, USART_0, 10},
+#endif
+#ifdef LEUART0_BASE
+ /* LEUART0 */
{PD9, LEUART_0, 17},
{PD10, LEUART_0, 18},
{PD11, LEUART_0, 19},
@@ -576,7 +609,9 @@ const PinMap PinMap_UART_TX[] = {
{PD13, LEUART_0, 21},
{PD14, LEUART_0, 22},
{PD15, LEUART_0, 23},
-
+#endif
+#ifdef USART1_BASE
+ /* USART1 */
{PC6, USART_1, 11},
{PC7, USART_1, 12},
{PC8, USART_1, 13},
@@ -591,7 +626,8 @@ const PinMap PinMap_UART_TX[] = {
{PF5, USART_1, 29},
{PF6, USART_1, 30},
{PF7, USART_1, 31},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA6, USART_2, 1},
{PA7, USART_2, 2},
@@ -617,7 +653,8 @@ const PinMap PinMap_UART_TX[] = {
{PK0, USART_2, 29},
{PK1, USART_2, 30},
{PK2, USART_2, 31},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, USART_3, 16},
{PJ15, USART_3, 17},
@@ -627,11 +664,13 @@ const PinMap PinMap_UART_TX[] = {
{PC3, USART_3, 21},
{PC4, USART_3, 22},
{PC5, USART_3, 23},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef USART0_BASE
+ /* USART0 */
{PA0, USART_0, 31},
{PA1, USART_0, 0},
{PA2, USART_0, 1},
@@ -643,6 +682,9 @@ const PinMap PinMap_UART_RX[] = {
{PB13, USART_0, 7},
{PB14, USART_0, 8},
{PB15, USART_0, 9},
+#endif
+#ifdef LEUART0_BASE
+ /* LEUART0 */
{PD9, LEUART_0, 16},
{PD10, LEUART_0, 17},
{PD11, LEUART_0, 18},
@@ -650,7 +692,9 @@ const PinMap PinMap_UART_RX[] = {
{PD13, LEUART_0, 20},
{PD14, LEUART_0, 21},
{PD15, LEUART_0, 22},
-
+#endif
+#ifdef USART1_BASE
+ /* USART1 */
{PC6, USART_1, 10},
{PC7, USART_1, 11},
{PC8, USART_1, 12},
@@ -665,7 +709,8 @@ const PinMap PinMap_UART_RX[] = {
{PF5, USART_1, 28},
{PF6, USART_1, 29},
{PF7, USART_1, 30},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA6, USART_2, 0},
{PA7, USART_2, 1},
@@ -691,7 +736,8 @@ const PinMap PinMap_UART_RX[] = {
{PK0, USART_2, 28},
{PK1, USART_2, 29},
{PK2, USART_2, 30},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, USART_3, 15},
{PJ15, USART_3, 16},
@@ -701,6 +747,6 @@ const PinMap PinMap_UART_RX[] = {
{PC3, USART_3, 20},
{PC4, USART_3, 21},
{PC5, USART_3, 22},
-
+#endif
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralPins.h
deleted file mode 100644
index 79d6072e83..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG12/PeripheralPins.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralPins.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************ADC***************/
-extern const PinMap PinMap_ADC[];
-
-/************I2C SCL***********/
-extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
-extern const PinMap PinMap_I2C_SDA[];
-
-/************PWM***************/
-extern const PinMap PinMap_PWM[];
-
-/************SPI***************/
-extern const PinMap PinMap_SPI_MOSI[];
-extern const PinMap PinMap_SPI_MISO[];
-extern const PinMap PinMap_SPI_CLK[];
-extern const PinMap PinMap_SPI_CS[];
-
-/************UART**************/
-extern const PinMap PinMap_UART_TX[];
-extern const PinMap PinMap_UART_RX[];
-
-#endif
-
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralNames.h
deleted file mode 100644
index b72166faf0..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralNames.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralNames.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "em_adc.h"
-#include "em_usart.h"
-#include "em_i2c.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- DAC_0 = DAC0_BASE
-} DACName;
-
-typedef enum {
- ADC_0 = ADC0_BASE
-} ADCName;
-
-typedef enum {
- I2C_0 = I2C0_BASE,
- I2C_1 = I2C1_BASE
-} I2CName;
-
-typedef enum {
- PWM_CH0 = 0,
- PWM_CH1 = 1,
- PWM_CH2 = 2,
-} PWMName;
-
-typedef enum {
- UART_0 = UART0_BASE,
- UART_1 = UART1_BASE,
- USART_0 = USART0_BASE,
- USART_1 = USART1_BASE,
- USART_2 = USART2_BASE,
- LEUART_0 = LEUART0_BASE,
- LEUART_1 = LEUART1_BASE
-} UARTName;
-
-typedef enum {
- SPI_0 = USART0_BASE,
- SPI_1 = USART1_BASE,
- SPI_2 = USART2_BASE
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralPins.c
index 9a0d3708f5..6240140178 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralPins.c
@@ -26,6 +26,7 @@
/************ADC***************/
/* The third "function" value is used to select the correct ADC channel */
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PD0, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH0},
{PD1, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH1},
{PD2, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH2},
@@ -34,18 +35,22 @@ const PinMap PinMap_ADC[] = {
{PD5, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH5},
{PD6, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH6},
{PD7, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH7},
+#endif
{NC , NC , NC}
};
/************DAC***************/
const PinMap PinMap_DAC[] = {
+#ifdef DAC0_BASE
{PB11, DAC_0, 0},
{PB12, DAC_0, 1},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PD7, I2C_0, 1},
@@ -54,18 +59,20 @@ const PinMap PinMap_I2C_SCL[] = {
{PC1, I2C_0, 4},
{PF1, I2C_0, 5},
{PE13, I2C_0, 6},
-
+#endif
+#ifdef I2C1_BASE
/* I2C1 */
{PC5, I2C_1, 0},
{PB12, I2C_1, 1},
{PE1, I2C_1, 2},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PD6, I2C_0, 1},
@@ -74,160 +81,222 @@ const PinMap PinMap_I2C_SDA[] = {
{PC0, I2C_0, 4},
{PF0, I2C_0, 5},
{PE12, I2C_0, 6},
-
+#endif
+#ifdef I2C1_BASE
/* I2C1 */
{PC4, I2C_1, 0},
{PB11, I2C_1, 1},
{PE0, I2C_1, 2},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA8, PWM_CH0, 0},
- {PA9, PWM_CH1, 0},
- {PA10, PWM_CH2, 0},
{PA12, PWM_CH0, 1},
- {PA13, PWM_CH1, 1},
- {PA14, PWM_CH2, 1},
{PC8, PWM_CH0, 2},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
+ {PA9, PWM_CH1, 0},
+ {PA13, PWM_CH1, 1},
{PC9, PWM_CH1, 2},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
+ {PA10, PWM_CH2, 0},
+ {PA14, PWM_CH2, 1},
{PC10, PWM_CH2, 2},
+#endif
{NC , NC , 0}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE10, SPI_0, 0},
{PE7, SPI_0, 1},
{PC11, SPI_0, 2},
{PC0, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD0, SPI_1, 1},
{PD7, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC2, SPI_2, 0},
{PB3, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE11, SPI_0, 0},
{PE6, SPI_0, 1},
{PC10, SPI_0, 2},
{PC1, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD1, SPI_1, 1},
{PD6, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC3, SPI_2, 0},
{PB4, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE12, SPI_0, 0},
{PE5, SPI_0, 1},
{PC9, SPI_0, 2},
{PB13, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD2, SPI_1, 1},
{PF0, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC4, SPI_2, 0},
{PB5, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
+#ifdef USART0_BASE
/* USART0 */
{PE13, SPI_0, 0},
{PE4, SPI_0, 1},
{PC8, SPI_0, 2},
{PB14, SPI_0, 5},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PD3, SPI_1, 1},
{PF1, SPI_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC5, SPI_2, 0},
{PB6, SPI_2, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef UART0_BASE
/* UART0 */
{PF6, UART_0, 0},
{PE0, UART_0, 1},
+#endif
+#ifdef UART1_BASE
/* UART1 */
{PF10, UART_1, 1},
{PB9, UART_1, 2},
{PE2, UART_1, 3},
+#endif
+#ifdef USART0_BASE
/* USART0 */
{PE10, USART_0, 0},
{PE7, USART_0, 1},
{PC11, USART_0, 2},
{PE13, USART_0, 3},
{PB7, USART_0, 4},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC0, USART_1, 0},
{PD0, USART_1, 1},
{PD7, USART_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC2, USART_2, 0},
{PB3, USART_2, 1},
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD4, LEUART_0, 0},
{PB13, LEUART_0, 1},
{PE14, LEUART_0, 2},
{PF0, LEUART_0, 3},
{PF2, LEUART_0, 4},
+#endif
+#ifdef LEUART1_BASE
/* LEUART1 */
{PC6, LEUART_1, 0},
{PA5, LEUART_1, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef UART0_BASE
/* UART0 */
{PF7, UART_0, 0},
{PE1, UART_0, 1},
+#endif
+#ifdef UART1_BASE
/* UART1 */
{PF11, UART_1, 1},
{PB10, UART_1, 2},
{PE3, UART_1, 3},
+#endif
+#ifdef USART0_BASE
/* USART0 */
{PE11, USART_0, 0},
{PE6, USART_0, 1},
{PC10, USART_0, 2},
{PE12, USART_0, 3},
{PB8, USART_0, 4},
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC1, USART_1, 0},
{PD1, USART_1, 1},
{PD6, USART_1, 2},
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PC3, USART_2, 0},
{PB4, USART_2, 1},
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD5, LEUART_0, 0},
{PB14, LEUART_0, 1},
{PE15, LEUART_0, 2},
{PF1, LEUART_0, 3},
{PA0, LEUART_0, 4},
+#endif
+#ifdef LEUART1_BASE
/* LEUART1 */
{PC7, LEUART_1, 0},
{PA6, LEUART_1, 1},
+#endif
/* Not connected */
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralPins.h
deleted file mode 100644
index a75e29db71..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/PeripheralPins.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralPins.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************ADC***************/
-extern const PinMap PinMap_ADC[];
-
-/************DAC***************/
-extern const PinMap PinMap_DAC[];
-
-/************I2C SCL***********/
-extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
-extern const PinMap PinMap_I2C_SDA[];
-
-/************PWM***************/
-extern const PinMap PinMap_PWM[];
-
-/************SPI***************/
-extern const PinMap PinMap_SPI_MOSI[];
-extern const PinMap PinMap_SPI_MISO[];
-extern const PinMap PinMap_SPI_CLK[];
-extern const PinMap PinMap_SPI_CS[];
-
-/************UART**************/
-extern const PinMap PinMap_UART_TX[];
-extern const PinMap PinMap_UART_RX[];
-
-#endif
-
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralNames.h
deleted file mode 100644
index b72966b016..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralNames.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralNames.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "em_adc.h"
-#include "em_usart.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- ADC_0 = ADC0_BASE
-} ADCName;
-
-typedef enum {
- I2C_0 = I2C0_BASE
-} I2CName;
-
-typedef enum {
- PWM_CH0 = 0,
- PWM_CH1 = 1,
- PWM_CH2 = 2,
-} PWMName;
-
-typedef enum {
- USART_1 = USART1_BASE,
- LEUART_0 = LEUART0_BASE
-} UARTName;
-
-typedef enum {
- SPI_1 = USART1_BASE
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralPins.c
index ba9eb5d702..7974bcd82e 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralPins.c
@@ -25,102 +25,131 @@
/************ADC***************/
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PD4, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH4},
{PD5, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH5},
{PD6, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH6},
{PD7, ADC_0, ADC_SINGLECTRL_INPUTSEL_CH7},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PD7, I2C_0, 1},
{PC1, I2C_0, 4},
{PF1, I2C_0, 5},
{PE13, I2C_0, 6},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PD6, I2C_0, 1},
{PC0, I2C_0, 4},
{PF0, I2C_0, 5},
{PE12, I2C_0, 6},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA0, PWM_CH0, 0},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
{PA1, PWM_CH1, 0},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
{PA2, PWM_CH2, 0},
+#endif
{NC , NC , NC}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
+#ifdef USART1_BASE
/* USART1 */
{PC0, SPI_1, 0},
{PD7, SPI_1, 3},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
+#ifdef USART1_BASE
/* USART1 */
{PC1, SPI_1, 0},
{PD6, SPI_1, 3},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
+#ifdef USART1_BASE
/* USART1 */
{PB7, SPI_1, 0},
{PC15, SPI_1, 3},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
+#ifdef USART1_BASE
/* USART1 */
{PB8, SPI_1, 0},
{PC14, SPI_1, 3},
+#endif
/* Not connected */
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef USART1_BASE
/* USART1 */
{PC0, USART_1, 0},
{PD7, USART_1, 3},
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD4, LEUART_0, 0},
{PB13, LEUART_0, 1},
{PF0, LEUART_0, 3},
{PF2, LEUART_0, 4},
+#endif
/* Not connected */
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef USART1_BASE
/* USART1 */
{PC1, USART_1, 0},
{PD6, USART_1, 3},
+#endif
+#ifdef LEUART0_BASE
/* LEUART0 */
{PD5, LEUART_0, 0},
{PB14, LEUART_0, 1},
{PF1, LEUART_0, 3},
{PA0, LEUART_0, 4},
+#endif
/* Not connected */
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralPins.h
deleted file mode 100644
index a19c09da7a..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/PeripheralPins.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralPins.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************ADC***************/
-extern const PinMap PinMap_ADC[];
-
-/************I2C SCL***********/
-extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
-extern const PinMap PinMap_I2C_SDA[];
-
-/************PWM***************/
-extern const PinMap PinMap_PWM[];
-
-/************SPI***************/
-extern const PinMap PinMap_SPI_MOSI[];
-extern const PinMap PinMap_SPI_MISO[];
-extern const PinMap PinMap_SPI_CLK[];
-extern const PinMap PinMap_SPI_CS[];
-
-/************UART**************/
-extern const PinMap PinMap_UART_TX[];
-extern const PinMap PinMap_UART_RX[];
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralNames.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralNames.h
deleted file mode 100644
index 813fd47e85..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralNames.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralNames.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-#ifndef MBED_PERIPHERALNAMES_H
-#define MBED_PERIPHERALNAMES_H
-
-#include "em_adc.h"
-#include "em_usart.h"
-#include "em_i2c.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- ADC_0 = ADC0_BASE
-} ADCName;
-
-typedef enum {
- I2C_0 = I2C0_BASE,
-} I2CName;
-
-typedef enum {
- PWM_CH0 = 0,
- PWM_CH1 = 1,
- PWM_CH2 = 2,
- PWM_CH3 = 3
-} PWMName;
-
-typedef enum {
- USART_0 = USART0_BASE,
- USART_1 = USART1_BASE,
- LEUART_0 = LEUART0_BASE,
-} UARTName;
-
-typedef enum {
- SPI_0 = USART0_BASE,
- SPI_1 = USART1_BASE,
-} SPIName;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralPins.c
index 95baad0840..6e6078a785 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralPins.c
@@ -26,6 +26,7 @@
/************ADC***************/
/* The third "function" value is used to select the correct ADC channel */
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PA0, ADC_0, adcPosSelAPORT3XCH8},
{PA1, ADC_0, adcPosSelAPORT4XCH9},
{PA2, ADC_0, adcPosSelAPORT3XCH10},
@@ -61,11 +62,13 @@ const PinMap PinMap_ADC[] = {
{PF5, ADC_0, adcPosSelAPORT2XCH21},
{PF6, ADC_0, adcPosSelAPORT1XCH22},
{PF7, ADC_0, adcPosSelAPORT2XCH23},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PA2, I2C_0, 1},
@@ -99,12 +102,13 @@ const PinMap PinMap_I2C_SCL[] = {
{PF6, I2C_0, 29},
{PF7, I2C_0, 30},
{PA0, I2C_0, 31},
-
+#endif
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PA1, I2C_0, 1},
@@ -138,52 +142,63 @@ const PinMap PinMap_I2C_SDA[] = {
{PF5, I2C_0, 29},
{PF6, I2C_0, 30},
{PF7, I2C_0, 31},
-
+#endif
/* Not connected */
{NC , NC , NC}
};
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA0, PWM_CH0, 0},
- {PA1, PWM_CH1, 0},
- {PA2, PWM_CH2, 0},
- {PA3, PWM_CH3, 0},
- {PA4, PWM_CH2, 2},
- {PA5, PWM_CH3, 2},
- {PB11, PWM_CH1, 5},
- {PB12, PWM_CH2, 5},
- {PB13, PWM_CH3, 5},
{PB14, PWM_CH0, 9},
{PB15, PWM_CH0, 10},
{PC6, PWM_CH0, 11},
+ {PD10, PWM_CH0, 18},
+ {PD14, PWM_CH0, 22},
+ {PF0, PWM_CH0, 24},
+ {PF4, PWM_CH0, 28},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
+ {PA1, PWM_CH1, 0},
+ {PB11, PWM_CH1, 5},
{PC7, PWM_CH1, 11},
+ {PD11, PWM_CH1, 18},
+ {PD15, PWM_CH1, 22},
+ {PF1, PWM_CH1, 24},
+ {PF5, PWM_CH1, 28},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
+ {PA2, PWM_CH2, 0},
+ {PA4, PWM_CH2, 2},
+ {PB12, PWM_CH2, 5},
{PC8, PWM_CH2, 11},
- {PC9, PWM_CH3, 11},
{PC10, PWM_CH2, 13},
+ {PD12, PWM_CH2, 18},
+ {PF2, PWM_CH2, 24},
+ {PF6, PWM_CH2, 28},
+#endif
+#if defined(TIMER_ROUTE_CC3PEN) || defined(TIMER_ROUTEPEN_CC3PEN)
+ /* PWM3 */
+ {PA3, PWM_CH3, 0},
+ {PA5, PWM_CH3, 2},
+ {PB13, PWM_CH3, 5},
+ {PC9, PWM_CH3, 11},
{PC11, PWM_CH3, 13},
{PD9, PWM_CH3, 14},
- {PD10, PWM_CH0, 18},
- {PD11, PWM_CH1, 18},
- {PD12, PWM_CH2, 18},
{PD13, PWM_CH3, 18},
- {PD14, PWM_CH0, 22},
- {PD15, PWM_CH1, 22},
- {PF0, PWM_CH0, 24},
- {PF1, PWM_CH1, 24},
- {PF2, PWM_CH2, 24},
{PF3, PWM_CH3, 24},
- {PF4, PWM_CH0, 28},
- {PF5, PWM_CH1, 28},
- {PF6, PWM_CH2, 28},
{PF7, PWM_CH3, 28},
-
+#endif
{NC , NC , NC}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 0},
{PA1, SPI_0, 1},
@@ -203,7 +218,8 @@ const PinMap PinMap_SPI_MOSI[] = {
{PD13, SPI_0, 21},
{PD14, SPI_0, 22},
{PD15, SPI_0, 23},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 11},
{PC7, SPI_1, 12},
@@ -219,12 +235,12 @@ const PinMap PinMap_SPI_MOSI[] = {
{PF5, SPI_1, 29},
{PF6, SPI_1, 30},
{PF7, SPI_1, 31},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 31},
{PA1, SPI_0, 0},
@@ -244,7 +260,8 @@ const PinMap PinMap_SPI_MISO[] = {
{PD13, SPI_0, 20},
{PD14, SPI_0, 21},
{PD15, SPI_0, 22},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 10},
{PC7, SPI_1, 11},
@@ -261,12 +278,12 @@ const PinMap PinMap_SPI_MISO[] = {
{PF6, SPI_1, 29},
{PF7, SPI_1, 30},
{PA0, SPI_1, 31},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 30},
{PA1, SPI_0, 31},
@@ -286,7 +303,8 @@ const PinMap PinMap_SPI_CLK[] = {
{PD13, SPI_0, 19},
{PD14, SPI_0, 20},
{PD15, SPI_0, 21},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 9},
{PC7, SPI_1, 10},
@@ -304,12 +322,12 @@ const PinMap PinMap_SPI_CLK[] = {
{PF7, SPI_1, 29},
{PA0, SPI_1, 30},
{PA1, SPI_1, 31},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 29},
{PA1, SPI_0, 30},
@@ -329,7 +347,8 @@ const PinMap PinMap_SPI_CS[] = {
{PD13, SPI_0, 18},
{PD14, SPI_0, 19},
{PD15, SPI_0, 20},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 8},
{PC7, SPI_1, 9},
@@ -345,12 +364,14 @@ const PinMap PinMap_SPI_CS[] = {
{PF5, SPI_1, 26},
{PF6, SPI_1, 27},
{PF7, SPI_1, 28},
-
+#endif
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef USART0_BASE
+ /* USART0 */
{PA0, USART_0, 0},
{PA1, USART_0, 1},
{PA2, USART_0, 2},
@@ -362,6 +383,9 @@ const PinMap PinMap_UART_TX[] = {
{PB13, USART_0, 8},
{PB14, USART_0, 9},
{PB15, USART_0, 10},
+#endif
+#ifdef LEUART0_BASE
+ /* LEUART0 */
{PD9, LEUART_0, 17},
{PD10, LEUART_0, 18},
{PD11, LEUART_0, 19},
@@ -369,7 +393,9 @@ const PinMap PinMap_UART_TX[] = {
{PD13, LEUART_0, 21},
{PD14, LEUART_0, 22},
{PD15, LEUART_0, 23},
-
+#endif
+#ifdef USART1_BASE
+ /* USART1 */
{PC6, USART_1, 11},
{PC7, USART_1, 12},
{PC8, USART_1, 13},
@@ -384,11 +410,13 @@ const PinMap PinMap_UART_TX[] = {
{PF5, USART_1, 29},
{PF6, USART_1, 30},
{PF7, USART_1, 31},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef USART0_BASE
+ /* USART0 */
{PA0, USART_0, 31},
{PA1, USART_0, 0},
{PA2, USART_0, 1},
@@ -400,6 +428,9 @@ const PinMap PinMap_UART_RX[] = {
{PB13, USART_0, 7},
{PB14, USART_0, 8},
{PB15, USART_0, 9},
+#endif
+#ifdef LEUART0_BASE
+ /* LEUART0 */
{PD9, LEUART_0, 16},
{PD10, LEUART_0, 17},
{PD11, LEUART_0, 18},
@@ -407,7 +438,9 @@ const PinMap PinMap_UART_RX[] = {
{PD13, LEUART_0, 20},
{PD14, LEUART_0, 21},
{PD15, LEUART_0, 22},
-
+#endif
+#ifdef USART1_BASE
+ /* USART1 */
{PC6, USART_1, 10},
{PC7, USART_1, 11},
{PC8, USART_1, 12},
@@ -422,6 +455,6 @@ const PinMap PinMap_UART_RX[] = {
{PF5, USART_1, 28},
{PF6, USART_1, 29},
{PF7, USART_1, 30},
-
+#endif
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralPins.h
deleted file mode 100644
index 79d6072e83..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG1/PeripheralPins.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralPins.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************ADC***************/
-extern const PinMap PinMap_ADC[];
-
-/************I2C SCL***********/
-extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
-extern const PinMap PinMap_I2C_SDA[];
-
-/************PWM***************/
-extern const PinMap PinMap_PWM[];
-
-/************SPI***************/
-extern const PinMap PinMap_SPI_MOSI[];
-extern const PinMap PinMap_SPI_MISO[];
-extern const PinMap PinMap_SPI_CLK[];
-extern const PinMap PinMap_SPI_CS[];
-
-/************UART**************/
-extern const PinMap PinMap_UART_TX[];
-extern const PinMap PinMap_UART_RX[];
-
-#endif
-
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralPins.c b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralPins.c
index 79f7f1933e..8a5324d0a3 100644
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralPins.c
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralPins.c
@@ -26,6 +26,7 @@
/************ADC***************/
/* The third "function" value is used to select the correct ADC channel */
const PinMap PinMap_ADC[] = {
+#ifdef ADC0_BASE
{PA0, ADC_0, adcPosSelAPORT3XCH8},
{PA1, ADC_0, adcPosSelAPORT4XCH9},
{PA2, ADC_0, adcPosSelAPORT3XCH10},
@@ -61,11 +62,13 @@ const PinMap PinMap_ADC[] = {
{PF5, ADC_0, adcPosSelAPORT2XCH21},
{PF6, ADC_0, adcPosSelAPORT1XCH22},
{PF7, ADC_0, adcPosSelAPORT2XCH23},
+#endif
{NC , NC , NC}
};
/************I2C SCL***********/
const PinMap PinMap_I2C_SCL[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA1, I2C_0, 0},
{PA2, I2C_0, 1},
@@ -99,7 +102,9 @@ const PinMap PinMap_I2C_SCL[] = {
{PF6, I2C_0, 29},
{PF7, I2C_0, 30},
{PA0, I2C_0, 31},
-
+#endif
+#ifdef I2C1_BASE
+ /* I2C1 */
{PA7, I2C_1, 0},
{PA8, I2C_1, 1},
{PA9, I2C_1, 2},
@@ -130,12 +135,13 @@ const PinMap PinMap_I2C_SCL[] = {
{PK1, I2C_1, 29},
{PK2, I2C_1, 30},
{PA6, I2C_1, 31},
-
+#endif
{NC , NC , NC}
};
/************I2C SDA***********/
const PinMap PinMap_I2C_SDA[] = {
+#ifdef I2C0_BASE
/* I2C0 */
{PA0, I2C_0, 0},
{PA1, I2C_0, 1},
@@ -169,7 +175,9 @@ const PinMap PinMap_I2C_SDA[] = {
{PF5, I2C_0, 29},
{PF6, I2C_0, 30},
{PF7, I2C_0, 31},
-
+#endif
+#ifdef I2C1_BASE
+ /* I2C1 */
{PA6, I2C_1, 0},
{PA7, I2C_1, 1},
{PA8, I2C_1, 2},
@@ -200,7 +208,7 @@ const PinMap PinMap_I2C_SDA[] = {
{PK0, I2C_1, 29},
{PK1, I2C_1, 30},
{PK2, I2C_1, 31},
-
+#endif
/* Not connected */
{NC , NC , NC}
@@ -208,45 +216,56 @@ const PinMap PinMap_I2C_SDA[] = {
/************PWM***************/
const PinMap PinMap_PWM[] = {
+#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
+ /* PWM0 */
{PA0, PWM_CH0, 0},
- {PA1, PWM_CH1, 0},
- {PA2, PWM_CH2, 0},
- {PA3, PWM_CH3, 0},
- {PA4, PWM_CH2, 2},
- {PA5, PWM_CH3, 2},
- {PB11, PWM_CH1, 5},
- {PB12, PWM_CH2, 5},
- {PB13, PWM_CH3, 5},
{PB14, PWM_CH0, 9},
{PB15, PWM_CH0, 10},
{PC6, PWM_CH0, 11},
+ {PD10, PWM_CH0, 18},
+ {PD14, PWM_CH0, 22},
+ {PF0, PWM_CH0, 24},
+ {PF4, PWM_CH0, 28},
+#endif
+#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
+ /* PWM1 */
+ {PA1, PWM_CH1, 0},
+ {PB11, PWM_CH1, 5},
{PC7, PWM_CH1, 11},
+ {PD11, PWM_CH1, 18},
+ {PD15, PWM_CH1, 22},
+ {PF1, PWM_CH1, 24},
+ {PF5, PWM_CH1, 28},
+#endif
+#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
+ /* PWM2 */
+ {PA2, PWM_CH2, 0},
+ {PA4, PWM_CH2, 2},
+ {PB12, PWM_CH2, 5},
{PC8, PWM_CH2, 11},
- {PC9, PWM_CH3, 11},
{PC10, PWM_CH2, 13},
+ {PD12, PWM_CH2, 18},
+ {PF2, PWM_CH2, 24},
+ {PF6, PWM_CH2, 28},
+#endif
+#if defined(TIMER_ROUTE_CC3PEN) || defined(TIMER_ROUTEPEN_CC3PEN)
+ /* PWM3 */
+ {PA3, PWM_CH3, 0},
+ {PA5, PWM_CH3, 2},
+ {PB13, PWM_CH3, 5},
+ {PC9, PWM_CH3, 11},
{PC11, PWM_CH3, 13},
{PD9, PWM_CH3, 14},
- {PD10, PWM_CH0, 18},
- {PD11, PWM_CH1, 18},
- {PD12, PWM_CH2, 18},
{PD13, PWM_CH3, 18},
- {PD14, PWM_CH0, 22},
- {PD15, PWM_CH1, 22},
- {PF0, PWM_CH0, 24},
- {PF1, PWM_CH1, 24},
- {PF2, PWM_CH2, 24},
{PF3, PWM_CH3, 24},
- {PF4, PWM_CH0, 28},
- {PF5, PWM_CH1, 28},
- {PF6, PWM_CH2, 28},
{PF7, PWM_CH3, 28},
-
+#endif
{NC , NC , NC}
};
/*************SPI**************/
const PinMap PinMap_SPI_MOSI[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 0},
{PA1, SPI_0, 1},
@@ -266,7 +285,8 @@ const PinMap PinMap_SPI_MOSI[] = {
{PD13, SPI_0, 21},
{PD14, SPI_0, 22},
{PD15, SPI_0, 23},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 11},
{PC7, SPI_1, 12},
@@ -282,7 +302,8 @@ const PinMap PinMap_SPI_MOSI[] = {
{PF5, SPI_1, 29},
{PF6, SPI_1, 30},
{PF7, SPI_1, 31},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA6, SPI_2, 1},
{PA7, SPI_2, 2},
@@ -308,7 +329,8 @@ const PinMap PinMap_SPI_MOSI[] = {
{PK0, SPI_2, 29},
{PK1, SPI_2, 30},
{PK2, SPI_2, 31},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, SPI_3, 16},
{PJ15, SPI_3, 17},
@@ -318,12 +340,12 @@ const PinMap PinMap_SPI_MOSI[] = {
{PC3, SPI_3, 21},
{PC4, SPI_3, 22},
{PC5, SPI_3, 23},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_MISO[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 31},
{PA1, SPI_0, 0},
@@ -343,7 +365,8 @@ const PinMap PinMap_SPI_MISO[] = {
{PD13, SPI_0, 20},
{PD14, SPI_0, 21},
{PD15, SPI_0, 22},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 10},
{PC7, SPI_1, 11},
@@ -360,7 +383,8 @@ const PinMap PinMap_SPI_MISO[] = {
{PF6, SPI_1, 29},
{PF7, SPI_1, 30},
{PA0, SPI_1, 31},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA6, SPI_2, 0},
{PA7, SPI_2, 1},
@@ -386,7 +410,8 @@ const PinMap PinMap_SPI_MISO[] = {
{PK0, SPI_2, 28},
{PK1, SPI_2, 29},
{PK2, SPI_2, 30},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, SPI_3, 15},
{PJ15, SPI_3, 16},
@@ -396,12 +421,12 @@ const PinMap PinMap_SPI_MISO[] = {
{PC3, SPI_3, 20},
{PC4, SPI_3, 21},
{PC5, SPI_3, 22},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_CLK[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 30},
{PA1, SPI_0, 31},
@@ -421,7 +446,8 @@ const PinMap PinMap_SPI_CLK[] = {
{PD13, SPI_0, 19},
{PD14, SPI_0, 20},
{PD15, SPI_0, 21},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 9},
{PC7, SPI_1, 10},
@@ -439,7 +465,8 @@ const PinMap PinMap_SPI_CLK[] = {
{PF7, SPI_1, 29},
{PA0, SPI_1, 30},
{PA1, SPI_1, 31},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA7, SPI_2, 0},
{PA8, SPI_2, 1},
@@ -465,7 +492,8 @@ const PinMap PinMap_SPI_CLK[] = {
{PK1, SPI_2, 28},
{PK2, SPI_2, 29},
{PA6, SPI_2, 31},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, SPI_3, 14},
{PJ15, SPI_3, 15},
@@ -475,12 +503,12 @@ const PinMap PinMap_SPI_CLK[] = {
{PC3, SPI_3, 19},
{PC4, SPI_3, 20},
{PC5, SPI_3, 21},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_SPI_CS[] = {
-
+#ifdef USART0_BASE
/* USART0 */
{PA0, SPI_0, 29},
{PA1, SPI_0, 30},
@@ -500,7 +528,8 @@ const PinMap PinMap_SPI_CS[] = {
{PD13, SPI_0, 18},
{PD14, SPI_0, 19},
{PD15, SPI_0, 20},
-
+#endif
+#ifdef USART1_BASE
/* USART1 */
{PC6, SPI_1, 8},
{PC7, SPI_1, 9},
@@ -516,7 +545,8 @@ const PinMap PinMap_SPI_CS[] = {
{PF5, SPI_1, 26},
{PF6, SPI_1, 27},
{PF7, SPI_1, 28},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA8, SPI_2, 0},
{PA9, SPI_2, 1},
@@ -542,7 +572,8 @@ const PinMap PinMap_SPI_CS[] = {
{PK2, SPI_2, 28},
{PA6, SPI_2, 30},
{PA7, SPI_2, 31},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, SPI_3, 13},
{PJ15, SPI_3, 14},
@@ -552,12 +583,14 @@ const PinMap PinMap_SPI_CS[] = {
{PC3, SPI_3, 18},
{PC4, SPI_3, 19},
{PC5, SPI_3, 20},
-
+#endif
{NC , NC , NC}
};
/************UART**************/
const PinMap PinMap_UART_TX[] = {
+#ifdef USART0_BASE
+ /* USART0 */
{PA0, USART_0, 0},
{PA1, USART_0, 1},
{PA2, USART_0, 2},
@@ -569,6 +602,9 @@ const PinMap PinMap_UART_TX[] = {
{PB13, USART_0, 8},
{PB14, USART_0, 9},
{PB15, USART_0, 10},
+#endif
+#ifdef LEUART0_BASE
+ /* LEUART0 */
{PD9, LEUART_0, 17},
{PD10, LEUART_0, 18},
{PD11, LEUART_0, 19},
@@ -576,7 +612,9 @@ const PinMap PinMap_UART_TX[] = {
{PD13, LEUART_0, 21},
{PD14, LEUART_0, 22},
{PD15, LEUART_0, 23},
-
+#endif
+#ifdef USART1_BASE
+ /* USART1 */
{PC6, USART_1, 11},
{PC7, USART_1, 12},
{PC8, USART_1, 13},
@@ -591,7 +629,8 @@ const PinMap PinMap_UART_TX[] = {
{PF5, USART_1, 29},
{PF6, USART_1, 30},
{PF7, USART_1, 31},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA6, USART_2, 1},
{PA7, USART_2, 2},
@@ -617,7 +656,8 @@ const PinMap PinMap_UART_TX[] = {
{PK0, USART_2, 29},
{PK1, USART_2, 30},
{PK2, USART_2, 31},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, USART_3, 16},
{PJ15, USART_3, 17},
@@ -627,11 +667,13 @@ const PinMap PinMap_UART_TX[] = {
{PC3, USART_3, 21},
{PC4, USART_3, 22},
{PC5, USART_3, 23},
-
+#endif
{NC , NC , NC}
};
const PinMap PinMap_UART_RX[] = {
+#ifdef USART0_BASE
+ /* USART0 */
{PA0, USART_0, 31},
{PA1, USART_0, 0},
{PA2, USART_0, 1},
@@ -643,6 +685,9 @@ const PinMap PinMap_UART_RX[] = {
{PB13, USART_0, 7},
{PB14, USART_0, 8},
{PB15, USART_0, 9},
+#endif
+#ifdef LEUART0_BASE
+ /* LEUART0 */
{PD9, LEUART_0, 16},
{PD10, LEUART_0, 17},
{PD11, LEUART_0, 18},
@@ -650,7 +695,9 @@ const PinMap PinMap_UART_RX[] = {
{PD13, LEUART_0, 20},
{PD14, LEUART_0, 21},
{PD15, LEUART_0, 22},
-
+#endif
+#ifdef USART1_BASE
+ /* USART1 */
{PC6, USART_1, 10},
{PC7, USART_1, 11},
{PC8, USART_1, 12},
@@ -665,7 +712,8 @@ const PinMap PinMap_UART_RX[] = {
{PF5, USART_1, 28},
{PF6, USART_1, 29},
{PF7, USART_1, 30},
-
+#endif
+#ifdef USART2_BASE
/* USART2 */
{PA6, USART_2, 0},
{PA7, USART_2, 1},
@@ -691,7 +739,8 @@ const PinMap PinMap_UART_RX[] = {
{PK0, USART_2, 28},
{PK1, USART_2, 29},
{PK2, USART_2, 30},
-
+#endif
+#ifdef USART3_BASE
/* USART3 */
{PJ14, USART_3, 15},
{PJ15, USART_3, 16},
@@ -701,6 +750,6 @@ const PinMap PinMap_UART_RX[] = {
{PC3, USART_3, 20},
{PC4, USART_3, 21},
{PC5, USART_3, 22},
-
+#endif
{NC , NC , NC}
};
diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralPins.h b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralPins.h
deleted file mode 100644
index 79d6072e83..0000000000
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralPins.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************//**
- * @file PeripheralPins.h
- *******************************************************************************
- * @section License
- * (C) Copyright 2015 Silicon Labs, http://www.silabs.com
- *******************************************************************************
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-#ifndef MBED_PERIPHERALPINS_H
-#define MBED_PERIPHERALPINS_H
-
-#include "pinmap.h"
-#include "PeripheralNames.h"
-
-/************ADC***************/
-extern const PinMap PinMap_ADC[];
-
-/************I2C SCL***********/
-extern const PinMap PinMap_I2C_SCL[];
-
-/************I2C SDA***********/
-extern const PinMap PinMap_I2C_SDA[];
-
-/************PWM***************/
-extern const PinMap PinMap_PWM[];
-
-/************SPI***************/
-extern const PinMap PinMap_SPI_MOSI[];
-extern const PinMap PinMap_SPI_MISO[];
-extern const PinMap PinMap_SPI_CLK[];
-extern const PinMap PinMap_SPI_CS[];
-
-/************UART**************/
-extern const PinMap PinMap_UART_TX[];
-extern const PinMap PinMap_UART_RX[];
-
-#endif
-