Browse Source

boards/msba2: unified LED defines

pr/gpio
Hauke Petersen 7 years ago
parent
commit
a2d78b465d
  1. 32
      boards/msba2/board_init.c
  2. 21
      boards/msba2/include/board.h

32
boards/msba2/board_init.c

@ -27,28 +27,6 @@
#include "board.h"
#include "cpu.h"
void loop_delay(void)
{
volatile uint16_t i, j;
for (i = 1; i < 30; i++) {
for (j = 1; j != 0; j++) {
asm volatile(" nop ");
}
}
}
void bl_blink(void)
{
LED_RED_ON;
LED_GREEN_ON;
loop_delay();
LED_RED_OFF;
LED_GREEN_OFF;
}
void bl_init_ports(void)
{
gpio_init_ports();
@ -58,13 +36,11 @@ void bl_init_ports(void)
PINSEL0 &= ~(BIT5 + BIT7);
/* LEDS */
FIO3DIR |= LED_RED_PIN;
FIO3DIR |= LED_GREEN_PIN;
LED_RED_OFF;
LED_GREEN_OFF;
FIO3DIR |= LED0_MASK;
FIO3DIR |= LED1_MASK;
/* short blinking of both of the LEDs on startup */
bl_blink();
LED0_OFF;
LED0_OFF;
}
void init_clks1(void)

21
boards/msba2/include/board.h

@ -29,19 +29,22 @@ extern "C" {
#endif
/**
* @brief Board LED defines
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PIN (BIT25)
#define LED_GREEN_PIN (BIT26)
#define LED0_PIN GPIO_PIN(2, 25)
#define LED1_PIN GPIO_PIN(2, 26)
#define LED_GREEN_OFF (FIO3SET = LED_GREEN_PIN)
#define LED_GREEN_ON (FIO3CLR = LED_GREEN_PIN)
#define LED_GREEN_TOGGLE (FIO3PIN ^= LED_GREEN_PIN)
#define LED0_MASK (BIT25)
#define LED1_MASK (BIT26)
#define LED_RED_OFF (FIO3SET = LED_RED_PIN)
#define LED_RED_ON (FIO3CLR = LED_RED_PIN)
#define LED_RED_TOGGLE (FIO3PIN ^= LED_RED_PIN)
#define LED0_OFF (FIO3SET = LED0_MASK)
#define LED0_ON (FIO3CLR = LED0_MASK)
#define LED0_TOGGLE (FIO3PIN ^= LED0_MASK)
#define LED1_OFF (FIO3SET = LED1_MASK)
#define LED1_ON (FIO3CLR = LED1_MASK)
#define LED1_TOGGLE (FIO3PIN ^= LED1_MASK)
/** @} */
/**

Loading…
Cancel
Save