mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
boards/nucleo-l1: unified LED defines
This commit is contained in:
parent
c90c23468b
commit
058d1967c8
@ -19,9 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "cpu.h"
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
static void leds_init(void);
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
@ -29,32 +27,5 @@ void board_init(void)
|
|||||||
cpu_init();
|
cpu_init();
|
||||||
|
|
||||||
/* initialize the boards LEDs */
|
/* initialize the boards LEDs */
|
||||||
leds_init();
|
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initialize the boards on-board LEDs
|
|
||||||
*
|
|
||||||
* The LED initialization is hard-coded in this function. As the LED is soldered
|
|
||||||
* onto the board it is fixed to its CPU pins.
|
|
||||||
*
|
|
||||||
* The green LED is connected to pin PA5
|
|
||||||
*/
|
|
||||||
static void leds_init(void)
|
|
||||||
{
|
|
||||||
/* enable clock for port GPIOE */
|
|
||||||
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
|
|
||||||
|
|
||||||
/* set output speed to 50MHz */
|
|
||||||
LED_GREEN_PORT->OSPEEDR |= 0x00000c00;
|
|
||||||
/* set output type to push-pull */
|
|
||||||
LED_GREEN_PORT->OTYPER &= ~(0x00000020);
|
|
||||||
/* configure pins as general outputs */
|
|
||||||
LED_GREEN_PORT->MODER &= ~(0x00000c00);
|
|
||||||
LED_GREEN_PORT->MODER |= 0x00000400;
|
|
||||||
/* disable pull resistors */
|
|
||||||
LED_GREEN_PORT->PUPDR &= ~(0x00000c00);
|
|
||||||
|
|
||||||
/* turn all LEDs off */
|
|
||||||
LED_GREEN_PORT->BRR = 0x00c0;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user