Skip to content

Commit

Permalink
boards/nucleo-f103: unified LED defines
Browse files Browse the repository at this point in the history
  • Loading branch information
haukepetersen committed Mar 15, 2016
1 parent 000fae0 commit 816a48c
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions boards/nucleo-f103/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,13 @@
*/

#include "board.h"
#include "cpu.h"
#include "periph/gpio.h"

static void leds_init(void);

void board_init(void)
{
/* initialize the CPU */
cpu_init();

/* initialize the boards LEDs */
leds_init();

/* pin remapping: in order to use the MCU peripherals with the Arduino
* compatible connectors. Some peripherals need to be remapped here. */
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN;
AFIO->MAPR |= AFIO_MAPR_I2C1_REMAP;
}

/**
* @brief Initialize the boards on-board LEDs
*
* The green LED is connected to pin PA5
*/
static void leds_init(void)
{
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
GPIOA->CR[0] &= ~(0x0f << 20);
GPIOA->CR[0] |= (0x03 << 20);
GPIOA->BRR = (1 << 5);
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
}

0 comments on commit 816a48c

Please sign in to comment.