boards/samr21-xpro: unified LED defines

This commit is contained in:
Hauke Petersen 2016-03-11 18:04:26 +01:00
parent 8959d36d95
commit f0618593ba
3 changed files with 12 additions and 30 deletions

View File

@ -20,17 +20,14 @@
* @} * @}
*/ */
#include <stdio.h>
#include "board.h" #include "board.h"
#include "cpu.h" #include "periph/gpio.h"
void board_init(void) void board_init(void)
{ {
/* initialize the on-board LED */
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
/* initialize the CPU */ /* initialize the CPU */
cpu_init(); cpu_init();
/* initialize the boards LED at pin PA19 */
LED_PORT.DIRSET.reg = (1 << LED_PIN);
LED_PORT.OUTSET.reg = (1 << LED_PIN);
LED_PORT.PINCFG[LED_PIN].bit.PULLEN = false;
} }

View File

@ -49,32 +49,17 @@ extern "C" {
.reset_pin = GPIO_PIN(PB, 15)} .reset_pin = GPIO_PIN(PB, 15)}
/** /**
* @name LED pin definitions * @brief LED pin definitions and handlers
* @{ * @{
*/ */
#define LED0_PIN GPIO_PIN(0, 19)
#define LED_PORT PORT->Group[0] #define LED_PORT PORT->Group[0]
#define LED_PIN (19) #define LED0_MASK (1 << 19)
#define LED_GPIO GPIO_PIN(0, 19)
/** @} */
/** #define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
* @name Macros for controlling the on-board LEDs. #define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
* @{ #define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
*/
#define LED_ON (LED_PORT.OUTCLR.reg = (1 << LED_PIN))
#define LED_OFF (LED_PORT.OUTSET.reg = (1 << LED_PIN))
#define LED_TOGGLE (LED_PORT.OUTTGL.reg = (1 << LED_PIN))
/* for compatability to other boards */
#define LED_GREEN_ON /* not available */
#define LED_GREEN_OFF /* not available */
#define LED_GREEN_TOGGLE /* not available */
#define LED_ORANGE_ON /* not available */
#define LED_ORANGE_OFF /* not available */
#define LED_ORANGE_TOGGLE /* not available */
#define LED_RED_ON LED_ON
#define LED_RED_OFF LED_OFF
#define LED_RED_TOGGLE LED_TOGGLE
/** @} */ /** @} */
/** /**

View File

@ -35,7 +35,7 @@ static const saul_gpio_params_t saul_gpio_params[] =
{ {
{ {
.name = "LED(orange)", .name = "LED(orange)",
.pin = LED_GPIO, .pin = LED0_PIN,
.dir = GPIO_DIR_OUT, .dir = GPIO_DIR_OUT,
.pull = GPIO_NOPULL, .pull = GPIO_NOPULL,
}, },