mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #4828 from haukepetersen/fix_nrf_leds
boards: cleaned up LED handling for NRF5x based boards
This commit is contained in:
commit
97ceaadaec
@ -24,7 +24,7 @@
|
||||
void board_init(void)
|
||||
{
|
||||
/* setup led(s) for debugging */
|
||||
NRF_GPIO->PIN_CNF[LED_RED_PIN] = GPIO_PIN_CNF_DIR_Output;
|
||||
NRF_GPIO->DIRSET = LED_RED_MASK;
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
|
@ -42,12 +42,18 @@
|
||||
* @name Macros for controlling the on-board LEDs.
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_PIN 16
|
||||
|
||||
#define LED_RED_ON (NRF_GPIO->OUTSET = (1 << LED_RED_PIN))
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTCLR = (1 << LED_RED_PIN))
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= (1 << LED_RED_PIN))
|
||||
#define LED_RED_PIN (GPIO_PIN(0, 16))
|
||||
#define LED_RED_MASK (1 << 16)
|
||||
|
||||
#define LED_RED_ON (NRF_GPIO->OUTSET = LED_RED_MASK)
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTCLR = LED_RED_MASK)
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_MASK)
|
||||
#define LED_GREEN_ON /* not available */
|
||||
#define LED_GREEN_OFF /* not available */
|
||||
#define LED_GREEN_TOGGLE /* not available */
|
||||
#define LED_BLUE_ON /* not available */
|
||||
#define LED_BLUE_OFF /* not available */
|
||||
#define LED_BLUE_TOGGLE /* not available */
|
||||
/* @} */
|
||||
|
||||
/**
|
||||
|
@ -24,8 +24,8 @@
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the boards LEDs, set pins as output and turn LEDs off */
|
||||
NRF_GPIO->DIRSET = (LED_RED_PIN | LED_GREEN_PIN | LED_BLUE_PIN);
|
||||
NRF_GPIO->OUTSET = (LED_RED_PIN | LED_GREEN_PIN | LED_BLUE_PIN);
|
||||
NRF_GPIO->DIRSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
||||
NRF_GPIO->OUTSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
}
|
||||
|
@ -43,24 +43,27 @@ extern "C" {
|
||||
* @name LED pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_PIN (1 << 21)
|
||||
#define LED_GREEN_PIN (1 << 22)
|
||||
#define LED_BLUE_PIN (1 << 23)
|
||||
#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)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Macros for controlling the on-board LEDs
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_ON (NRF_GPIO->OUTCLR = LED_RED_PIN)
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTSET = LED_RED_PIN)
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_PIN)
|
||||
#define LED_GREEN_ON (NRF_GPIO->OUTCLR = LED_GREEN_PIN)
|
||||
#define LED_GREEN_OFF (NRF_GPIO->OUTSET = LED_GREEN_PIN)
|
||||
#define LED_GREEN_TOGGLE (NRF_GPIO->OUT ^= LED_GREEN_PIN)
|
||||
#define LED_BLUE_ON (NRF_GPIO->OUTCLR = LED_BLUE_PIN)
|
||||
#define LED_BLUE_OFF (NRF_GPIO->OUTSET = LED_BLUE_PIN)
|
||||
#define LED_BLUE_TOGGLE (NRF_GPIO->OUT ^= LED_BLUE_PIN)
|
||||
#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)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
@ -45,15 +45,15 @@ extern "C" {
|
||||
* @brief RIOT LED macros for backwards compatibility
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_ON (NRF_P0->OUTSET = LED1_PIN)
|
||||
#define LED_RED_OFF (NRF_P0->OUTCLR = LED2_PIN)
|
||||
#define LED_RED_TOGGLE (NRF_P0->OUT ^= LED3_PIN)
|
||||
#define LED_GREEN_ON (NRF_P0->OUTSET = LED1_PIN)
|
||||
#define LED_GREEN_OFF (NRF_P0->OUTCLR = LED2_PIN)
|
||||
#define LED_GREEN_TOGGLE (NRF_P0->OUT ^= LED3_PIN)
|
||||
#define LED_ORANGE_ON (NRF_P0->OUTSET = LED1_PIN)
|
||||
#define LED_ORANGE_OFF (NRF_P0->OUTCLR = LED2_PIN)
|
||||
#define LED_ORANGE_TOGGLE (NRF_P0->OUT ^= LED3_PIN)
|
||||
#define LED_RED_ON (NRF_P0->OUTSET = LED1_MASK)
|
||||
#define LED_RED_OFF (NRF_P0->OUTCLR = LED1_MASK)
|
||||
#define LED_RED_TOGGLE (NRF_P0->OUT ^= LED1_MASK)
|
||||
#define LED_GREEN_ON (NRF_P0->OUTSET = LED2_MASK)
|
||||
#define LED_GREEN_OFF (NRF_P0->OUTCLR = LED2_MASK)
|
||||
#define LED_GREEN_TOGGLE (NRF_P0->OUT ^= LED2_MASK)
|
||||
#define LED_ORANGE_ON (NRF_P0->OUTSET = LED3_MASK)
|
||||
#define LED_ORANGE_OFF (NRF_P0->OUTCLR = LED3_MASK)
|
||||
#define LED_ORANGE_TOGGLE (NRF_P0->OUT ^= LED3_MASK)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@
|
||||
void board_init(void)
|
||||
{
|
||||
/* setup led(s) for debugging */
|
||||
NRF_GPIO->PIN_CNF[LED_RED_PIN] = GPIO_PIN_CNF_DIR_Output;
|
||||
NRF_GPIO->DIRSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
|
@ -33,25 +33,27 @@ extern "C" {
|
||||
* @name LED pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define ONBOARD_LED 1
|
||||
#define LED_RED_PIN (1 << 8)
|
||||
#define LED_GREEN_PIN (1 << 9)
|
||||
#define LED_BLUE_PIN (1 << 10)
|
||||
#define LED_RED_PIN (GPIO_PIN(0, 8))
|
||||
#define LED_GREEN_PIN (GPIO_PIN(0, 9))
|
||||
#define LED_BLUE_PIN (GPIO_PIN(0, 10))
|
||||
#define LED_RED_MASK (1 << 8)
|
||||
#define LED_GREEN_MASK (1 << 9)
|
||||
#define LED_BLUE_MASK (1 << 10)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Macros for controlling the on-board LEDs.
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_ON (NRF_GPIO->OUTCLR = LED_RED_PIN)
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTSET = LED_RED_PIN)
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_PIN)
|
||||
#define LED_GREEN_ON (NRF_GPIO->OUTCLR = LED_GREEN_PIN)
|
||||
#define LED_GREEN_OFF (NRF_GPIO->OUTSET = LED_GREEN_PIN)
|
||||
#define LED_GREEN_TOGGLE (NRF_GPIO->OUT ^= LED_GREEN_PIN)
|
||||
#define LED_BLUE_ON (NRF_GPIO->OUTCLR = LED_BLUE_PIN)
|
||||
#define LED_BLUE_OFF (NRF_GPIO->OUTSET = LED_BLUE_PIN)
|
||||
#define LED_BLUE_TOGGLE (NRF_GPIO->OUT ^= LED_BLUE_PIN)
|
||||
#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)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
@ -25,8 +25,8 @@
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the boards LEDs: set pins to output and turn LEDs off */
|
||||
NRF_GPIO->DIRSET = (LED_RED_PIN | LED_GREEN_PIN | LED_BLUE_PIN);
|
||||
NRF_GPIO->OUTSET = (LED_RED_PIN | LED_GREEN_PIN | LED_BLUE_PIN);
|
||||
NRF_GPIO->DIRSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
||||
NRF_GPIO->OUTSET = (LED_RED_MASK | LED_GREEN_MASK | LED_BLUE_MASK);
|
||||
/* trigger the CPU initialization code */
|
||||
cpu_init();
|
||||
}
|
||||
|
@ -43,25 +43,27 @@ extern "C" {
|
||||
* @name LED pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define ONBOARD_LED 1
|
||||
#define LED_RED_PIN (1 << 21)
|
||||
#define LED_GREEN_PIN (1 << 22)
|
||||
#define LED_BLUE_PIN (1 << 23)
|
||||
#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)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Macros for controlling the on-board LEDs.
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_ON (NRF_GPIO->OUTCLR = LED_RED_PIN)
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTSET = LED_RED_PIN)
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_PIN)
|
||||
#define LED_GREEN_ON (NRF_GPIO->OUTCLR = LED_GREEN_PIN)
|
||||
#define LED_GREEN_OFF (NRF_GPIO->OUTSET = LED_GREEN_PIN)
|
||||
#define LED_GREEN_TOGGLE (NRF_GPIO->OUT ^= LED_GREEN_PIN)
|
||||
#define LED_BLUE_ON (NRF_GPIO->OUTCLR = LED_BLUE_PIN)
|
||||
#define LED_BLUE_OFF (NRF_GPIO->OUTSET = LED_BLUE_PIN)
|
||||
#define LED_BLUE_TOGGLE (NRF_GPIO->OUT ^= LED_BLUE_PIN)
|
||||
#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)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@
|
||||
void board_init(void)
|
||||
{
|
||||
/* setup led(s) for debugging */
|
||||
NRF_GPIO->PIN_CNF[LED_RED_PIN] = GPIO_PIN_CNF_DIR_Output;
|
||||
NRF_GPIO->DIRSET = (LED_RED_MASK);
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
|
@ -43,11 +43,12 @@ extern "C" {
|
||||
* @name Macros for controlling the on-board LEDs.
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_PIN 1
|
||||
#define LED_RED_PIN (GPIO_PIN(0, 1))
|
||||
#define LED_RED_MASK (1 << 1)
|
||||
|
||||
#define LED_RED_ON (NRF_GPIO->OUTSET = (1 << LED_RED_PIN))
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTCLR = (1 << LED_RED_PIN))
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= (1 << LED_RED_PIN))
|
||||
#define LED_RED_ON (NRF_GPIO->OUTSET = (1 << LED_RED_MASK))
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTCLR = (1 << LED_RED_MASK))
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= (1 << LED_RED_MASK))
|
||||
#define LED_GREEN_ON /* not available */
|
||||
#define LED_GREEN_OFF /* not available */
|
||||
#define LED_GREEN_TOGGLE /* not available */
|
||||
|
@ -24,7 +24,7 @@
|
||||
void board_init(void)
|
||||
{
|
||||
/* setup led(s) for debugging */
|
||||
NRF_GPIO->PIN_CNF[LED_RED_PIN] = GPIO_PIN_CNF_DIR_Output;
|
||||
NRF_GPIO->DIRSET = (LED_RED_MASK);
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
|
@ -42,11 +42,12 @@ extern "C" {
|
||||
* @name Macros for controlling the on-board LEDs.
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_PIN 8
|
||||
#define LED_RED_PIN (GPIO_PIN(0, 8))
|
||||
#define LED_RED_MASK (1 << 8)
|
||||
|
||||
#define LED_RED_ON (NRF_GPIO->OUTSET = (1 << LED_RED_PIN))
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTCLR = (1 << LED_RED_PIN))
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= (1 << LED_RED_PIN))
|
||||
#define LED_RED_ON (NRF_GPIO->OUTSET = LED_RED_MASK)
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTCLR = LED_RED_MASK)
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_MASK)
|
||||
#define LED_GREEN_ON /* not available */
|
||||
#define LED_GREEN_OFF /* not available */
|
||||
#define LED_GREEN_TOGGLE /* not available */
|
||||
|
Loading…
Reference in New Issue
Block a user