1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/nrf51dongle: unified LED defines

This commit is contained in:
Hauke Petersen 2016-03-11 18:04:26 +01:00
parent 07c303ce73
commit e972431273
2 changed files with 24 additions and 24 deletions

View File

@ -18,14 +18,16 @@
* @}
*/
#include "cpu.h"
#include "board.h"
#include "periph/gpio.h"
void board_init(void)
{
/* initialize the boards LEDs, set pins as output and turn LEDs off */
NRF_GPIO->DIRSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
NRF_GPIO->OUTSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_init(LED2_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
/* initialize the CPU */
cpu_init();
}

View File

@ -40,30 +40,28 @@ extern "C" {
/** @} */
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PIN (GPIO_PIN(0, 21))
#define LED_GREEN_PIN (GPIO_PIN(0, 22))
#define LED_BLUE_PIN (GPIO_PIN(0, 23))
#define LED_RED_MASK (1 << 21)
#define LED_GREEN_MASK (1 << 22)
#define LED_BLUE_MASK (1 << 23)
/** @} */
#define LED0_PIN GPIO_PIN(0, 21)
#define LED1_PIN GPIO_PIN(0, 22)
#define LED2_PIN GPIO_PIN(0, 23)
/**
* @name Macros for controlling the on-board LEDs
* @{
*/
#define LED_RED_ON (NRF_GPIO->OUTCLR = LED_RED_MASK)
#define LED_RED_OFF (NRF_GPIO->OUTSET = LED_RED_MASK)
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_MASK)
#define LED_GREEN_ON (NRF_GPIO->OUTCLR = LED_GREEN_MASK)
#define LED_GREEN_OFF (NRF_GPIO->OUTSET = LED_GREEN_MASK)
#define LED_GREEN_TOGGLE (NRF_GPIO->OUT ^= LED_GREEN_MASK)
#define LED_BLUE_ON (NRF_GPIO->OUTCLR = LED_BLUE_MASK)
#define LED_BLUE_OFF (NRF_GPIO->OUTSET = LED_BLUE_MASK)
#define LED_BLUE_TOGGLE (NRF_GPIO->OUT ^= LED_BLUE_MASK)
#define LED0_MASK (1 << 21)
#define LED1_MASK (1 << 22)
#define LED2_MASK (1 << 23)
#define LED0_ON (NRF_GPIO->OUTCLR = LED0_MASK)
#define LED0_OFF (NRF_GPIO->OUTSET = LED0_MASK)
#define LED0_TOGGLE (NRF_GPIO->OUT ^= LED0_MASK)
#define LED1_ON (NRF_GPIO->OUTCLR = LED1_MASK)
#define LED1_OFF (NRF_GPIO->OUTSET = LED1_MASK)
#define LED1_TOGGLE (NRF_GPIO->OUT ^= LED1_MASK)
#define LED2_ON (NRF_GPIO->OUTCLR = LED2_MASK)
#define LED2_OFF (NRF_GPIO->OUTSET = LED2_MASK)
#define LED2_TOGGLE (NRF_GPIO->OUT ^= LED2_MASK)
/** @} */
/**