File tree 4 files changed +8
-2
lines changed
4 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ extern "C" {
13
13
#define LED_PORT GPIOA
14
14
#define LED_PIN GPIO_Pin_0
15
15
#define LED_STATE_ON 0
16
+ #define LED_CLOCK_EN () RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE)
17
+ #define LED_MODE GPIO_Mode_Out_OD
16
18
17
19
#define UART_DEV USART1
18
20
#define UART_CLOCK_EN () RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE)
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ extern "C" {
13
13
#define LED_PORT GPIOA
14
14
#define LED_PIN GPIO_Pin_0
15
15
#define LED_STATE_ON 0
16
+ #define LED_CLOCK_EN () RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE)
17
+ #define LED_MODE GPIO_Mode_Out_OD
16
18
17
19
#define UART_DEV USART2
18
20
#define UART_CLOCK_EN () RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE)
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ extern "C" {
13
13
#define LED_PORT GPIOA
14
14
#define LED_PIN GPIO_Pin_15
15
15
#define LED_STATE_ON 0
16
+ #define LED_CLOCK_EN () RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE)
17
+ #define LED_MODE GPIO_Mode_Out_OD
16
18
17
19
#define UART_DEV USART1
18
20
#define UART_CLOCK_EN () RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE)
Original file line number Diff line number Diff line change @@ -96,11 +96,11 @@ void board_init(void) {
96
96
SysTick_Config (SystemCoreClock / 1000 );
97
97
#endif
98
98
99
- RCC_APB2PeriphClockCmd ( RCC_APB2Periph_GPIOA , ENABLE );
99
+ LED_CLOCK_EN ( );
100
100
101
101
GPIO_InitTypeDef GPIO_InitStructure = {
102
102
.GPIO_Pin = LED_PIN ,
103
- .GPIO_Mode = GPIO_Mode_Out_OD ,
103
+ .GPIO_Mode = LED_MODE ,
104
104
.GPIO_Speed = GPIO_Speed_10MHz ,
105
105
};
106
106
GPIO_Init (LED_PORT , & GPIO_InitStructure );
You can’t perform that action at this time.
0 commit comments