stm32f0: stm32f1: gpio: enable GPIO for LED
This commit is contained in:
parent
a5dc77550d
commit
40ba5323f3
3 changed files with 8 additions and 0 deletions
|
@ -35,6 +35,9 @@ int gpio_init(void)
|
|||
gpio_mode_setup(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO1);
|
||||
gpio_set_af(GPIOB, GPIO_AF2, GPIO1);
|
||||
|
||||
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO8);
|
||||
gpio_set(GPIOC, GPIO8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ int rcc_init(void)
|
|||
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
rcc_periph_clock_enable(RCC_GPIOC);
|
||||
rcc_periph_clock_enable(RCC_SPI1);
|
||||
rcc_periph_clock_enable(RCC_USART1);
|
||||
rcc_periph_clock_enable(RCC_USART2);
|
||||
|
|
|
@ -36,6 +36,10 @@ int gpio_init(void)
|
|||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_TIM2_PR1_CH4);
|
||||
|
||||
/* Set up GPIO for LED. */
|
||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO0);
|
||||
gpio_clear(GPIOB, GPIO0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue