Skip to content

Commit 670c62c

Browse files
authored
Merge pull request #5984 from amq/efm32-peripherals
EFM32: make peripherals conditional
2 parents ce9f63f + fdc2274 commit 670c62c

27 files changed

+733
-1206
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFR32MG12/PeripheralNames.h renamed to targets/TARGET_Silicon_Labs/TARGET_EFM32/PeripheralNames.h

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,95 @@
3131
extern "C" {
3232
#endif
3333

34+
#if DEVICE_ANALOGIN
3435
typedef enum {
35-
ADC_0 = ADC0_BASE
36+
#ifdef ADC0_BASE
37+
ADC_0 = ADC0_BASE,
38+
#endif
3639
} ADCName;
40+
#endif
41+
42+
#if DEVICE_ANALOGOUT
43+
typedef enum {
44+
#ifdef DAC0_BASE
45+
DAC_0 = DAC0_BASE,
46+
#endif
47+
} DACName;
48+
#endif
3749

50+
#if DEVICE_I2C
3851
typedef enum {
52+
#ifdef I2C0_BASE
3953
I2C_0 = I2C0_BASE,
54+
#endif
55+
#ifdef I2C1_BASE
4056
I2C_1 = I2C1_BASE,
57+
#endif
4158
} I2CName;
59+
#endif
4260

61+
#if DEVICE_PWMOUT
4362
typedef enum {
63+
#if defined(TIMER_ROUTE_CC0PEN) || defined(TIMER_ROUTEPEN_CC0PEN)
4464
PWM_CH0 = 0,
65+
#endif
66+
#if defined(TIMER_ROUTE_CC1PEN) || defined(TIMER_ROUTEPEN_CC1PEN)
4567
PWM_CH1 = 1,
68+
#endif
69+
#if defined(TIMER_ROUTE_CC2PEN) || defined(TIMER_ROUTEPEN_CC2PEN)
4670
PWM_CH2 = 2,
47-
PWM_CH3 = 3
71+
#endif
72+
#if defined(TIMER_ROUTE_CC3PEN) || defined(TIMER_ROUTEPEN_CC3PEN)
73+
PWM_CH3 = 3,
74+
#endif
4875
} PWMName;
76+
#endif
77+
78+
#if DEVICE_SPI
79+
typedef enum {
80+
#ifdef USART0_BASE
81+
SPI_0 = USART0_BASE,
82+
#endif
83+
#ifdef USART1_BASE
84+
SPI_1 = USART1_BASE,
85+
#endif
86+
#ifdef USART2_BASE
87+
SPI_2 = USART2_BASE,
88+
#endif
89+
#ifdef USART3_BASE
90+
SPI_3 = USART3_BASE,
91+
#endif
92+
} SPIName;
93+
#endif
4994

95+
#if DEVICE_SERIAL
5096
typedef enum {
97+
#ifdef USART0_BASE
5198
USART_0 = USART0_BASE,
99+
#endif
100+
#ifdef USART1_BASE
52101
USART_1 = USART1_BASE,
102+
#endif
103+
#ifdef USART2_BASE
53104
USART_2 = USART2_BASE,
105+
#endif
106+
#ifdef USART3_BASE
54107
USART_3 = USART3_BASE,
108+
#endif
109+
#ifdef UART0_BASE
110+
UART_0 = UART0_BASE,
111+
#endif
112+
#ifdef UART1_BASE
113+
UART_1 = UART1_BASE,
114+
#endif
115+
#ifdef LEUART0_BASE
55116
LEUART_0 = LEUART0_BASE,
117+
#endif
118+
#ifdef LEUART1_BASE
119+
LEUART_1 = LEUART1_BASE,
120+
#endif
56121
} UARTName;
57-
58-
typedef enum {
59-
SPI_0 = USART0_BASE,
60-
SPI_1 = USART1_BASE,
61-
SPI_2 = USART2_BASE,
62-
SPI_3 = USART3_BASE,
63-
} SPIName;
122+
#endif
64123

65124
#ifdef __cplusplus
66125
}

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/PeripheralPins.h renamed to targets/TARGET_Silicon_Labs/TARGET_EFM32/PeripheralPins.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,40 @@
2727
#include "pinmap.h"
2828
#include "PeripheralNames.h"
2929

30+
#if DEVICE_ANALOGIN
3031
/************ADC***************/
3132
extern const PinMap PinMap_ADC[];
33+
#endif
3234

35+
#if DEVICE_ANALOGOUT
3336
/************DAC***************/
3437
extern const PinMap PinMap_DAC[];
38+
#endif
3539

36-
/************I2C SCL***********/
40+
#if DEVICE_I2C
41+
/************I2C***************/
3742
extern const PinMap PinMap_I2C_SCL[];
38-
39-
/************I2C SDA***********/
4043
extern const PinMap PinMap_I2C_SDA[];
44+
#endif
4145

46+
#if DEVICE_PWMOUT
4247
/************PWM***************/
4348
extern const PinMap PinMap_PWM[];
49+
#endif
4450

51+
#if DEVICE_SPI
4552
/************SPI***************/
4653
extern const PinMap PinMap_SPI_MOSI[];
4754
extern const PinMap PinMap_SPI_MISO[];
4855
extern const PinMap PinMap_SPI_CLK[];
4956
extern const PinMap PinMap_SPI_CS[];
57+
#endif
5058

59+
#if DEVICE_SERIAL
5160
/************UART**************/
5261
extern const PinMap PinMap_UART_TX[];
5362
extern const PinMap PinMap_UART_RX[];
63+
#endif
5464

5565
#endif
5666

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/PeripheralNames.h

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)