Merge pull request #5045 from haukepetersen/opt_boards_leddefines

boards: unified LED macros
This commit is contained in:
Hauke Petersen 2016-03-15 19:01:05 +01:00
commit 272f12dfb8
110 changed files with 1236 additions and 2073 deletions

View File

@ -23,9 +23,6 @@
void board_init(void)
{
/* setup led(s) for debugging */
NRF_GPIO->DIRSET = LED_RED_MASK;
/* initialize the CPU */
cpu_init();
}

View File

@ -38,24 +38,6 @@
#define XTIMER_BACKOFF (40)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#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 */
/* @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/

View File

@ -27,5 +27,5 @@ void board_init(void)
/* initialize the CPU */
cpu_init();
/* initialize the on-board Amber "L" LED @ pin PB27 */
gpio_init(LED_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
}

View File

@ -32,26 +32,11 @@ extern "C" {
* @name LED pin definitions
* @{
*/
#define LED_PORT PIOB
#define LED_BIT PIO_PB27
#define LED_PIN GPIO_PIN(PB, 27)
/** @} */
#define LED0_PIN GPIO_PIN(PB, 27)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_ON (LED_PORT->PIO_SODR = LED_BIT)
#define LED_OFF (LED_PORT->PIO_CODR = LED_BIT)
#define LED_TOGGLE (LED_PORT->PIO_ODSR ^= LED_BIT)
/* for compatability to other boards */
#define LED_GREEN_ON LED_ON
#define LED_GREEN_OFF LED_OFF
#define LED_GREEN_TOGGLE LED_TOGGLE
#define LED_RED_ON /* not available */
#define LED_RED_OFF /* not available */
#define LED_RED_TOGGLE /* not available */
#define LED0_ON (PIOB->PIO_SODR = PIO_PB27)
#define LED0_OFF (PIOB->PIO_CODR = PIO_PB27)
#define LED0_TOGGLE (PIOB->PIO_ODSR ^= PIO_PB27)
/** @} */
/**

View File

@ -43,28 +43,13 @@ void board_init(void)
/* initialize the CPU */
cpu_init();
/* initialize the boards LEDs */
led_init();
/* initialize the board LED (connected to pin PB7) */
DDRB |= (1 << DDB7);
PORTB &= ~(1 << 7);
enableIRQ();
}
/**
* @brief Initialize the boards on-board LED (Amber LED "L")
*
* The LED initialization is hard-coded in this function. As the LED is soldered
* onto the board it is fixed to its CPU pins.
*
* The LED is connected to the following pin:
* - LED: PB27
*/
void led_init(void)
{
LED_ENABLE_PORT;
LED_ON;
}
/**
* @brief Initialize the System, initialize IO via UART_0
*/

View File

@ -35,29 +35,16 @@ extern "C" {
#define UART_STDIO_BAUDRATE (9600U)
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_PORT PORTB
#define LED_PIN (1 << 7)
/** @} */
#define LED0_PIN GPIO_PIN(1, 7)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_ENABLE_PORT DDRB |= (1 << DDB7)
#define LED_ON LED_PORT |= LED_PIN
#define LED_OFF LED_PORT &= ~LED_PIN
#define LED_TOGGLE LED_PORT ^= LED_PIN;
#define LED0_MASK (1 << DDB7)
/* for compatability to other boards */
#define LED_GREEN_ON LED_ON
#define LED_GREEN_OFF LED_OFF
#define LED_GREEN_TOGGLE LED_TOGGLE
#define LED_RED_ON /* not available */
#define LED_RED_OFF /* not available */
#define LED_RED_TOGGLE /* not available */
#define LED0_ON (PORTB |= LED0_MASK)
#define LED0_OFF (PORTB &= ~LED0_MASK)
#define LED0_TOGGLE (PORTB ^= LED0_MASK)
/** @} */
/**

View File

@ -32,19 +32,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)
/** @} */
/**

View File

@ -29,17 +29,6 @@ static void led_init_helper(int gpio_num) {
IOC_PXX_OVER[gpio_num] = IOC_OVERRIDE_OE;
}
/**
* @brief Initialize the SmartRF06's on-board LEDs
*/
void led_init(void)
{
led_init_helper(LED_RED_GPIO);
led_init_helper(LED_GREEN_GPIO);
led_init_helper(LED_YELLOW_GPIO);
led_init_helper(LED_ORANGE_GPIO);
}
/**
* @brief Initialize the SmartRF06 board
*/
@ -49,7 +38,10 @@ void board_init(void)
cpu_init();
/* initialize the boards LEDs */
led_init();
led_init_helper(LED0_GPIO);
led_init_helper(LED1_GPIO);
led_init_helper(LED2_GPIO);
led_init_helper(LED3_GPIO);
}
/** @} */

View File

@ -28,34 +28,34 @@ extern "C" {
#endif
/**
* @name Macros for controlling the on-board LEDs.
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_GPIO GPIO_PC0 /**< Red LED GPIO pin */
#define LED_YELLOW_GPIO GPIO_PC1 /**< Yellow LED GPIO pin */
#define LED_GREEN_GPIO GPIO_PC2 /**< Green LED GPIO pin */
#define LED_ORANGE_GPIO GPIO_PC3 /**< Orange LED GPIO pin */
#define LED0_PIN GPIO_PIN(2, 0)
#define LED1_PIN GPIO_PIN(2, 1)
#define LED2_PIN GPIO_PIN(2, 2)
#define LED3_PIN GPIO_PIN(2, 3)
#define LED_RED_ON cc2538_gpio_set(LED_GREEN_GPIO)
#define LED_RED_OFF cc2538_gpio_clear(LED_GREEN_GPIO)
#define LED_RED_TOGGLE cc2538_gpio_toggle(LED_GREEN_GPIO)
#define LED0_GPIO GPIO_PC0 /**< red LED */
#define LED1_GPIO GPIO_PC1 /**< yellow LED */
#define LED2_GPIO GPIO_PC2 /**< green LED */
#define LED3_GPIO GPIO_PC3 /**< orange LED */
#define LED_YELLOW_ON cc2538_gpio_set(LED_YELLOW_GPIO)
#define LED_YELLOW_OFF cc2538_gpio_clear(LED_YELLOW_GPIO)
#define LED_YELLOW_TOGGLE cc2538_gpio_toggle(LED_YELLOW_GPIO)
#define LED0_ON cc2538_gpio_set(LED0_GPIO)
#define LED0_OFF cc2538_gpio_clear(LED0_GPIO)
#define LED0_TOGGLE cc2538_gpio_toggle(LED0_GPIO)
#define LED_GREEN_ON cc2538_gpio_set(LED_GREEN_GPIO)
#define LED_GREEN_OFF cc2538_gpio_clear(LED_GREEN_GPIO)
#define LED_GREEN_TOGGLE cc2538_gpio_toggle(LED_GREEN_GPIO)
#define LED1_ON cc2538_gpio_set(LED1_GPIO)
#define LED1_OFF cc2538_gpio_clear(LED1_GPIO)
#define LED1_TOGGLE cc2538_gpio_toggle(LED1_GPIO)
#define LED_ORANGE_ON cc2538_gpio_set(LED_ORANGE_GPIO)
#define LED_ORANGE_OFF cc2538_gpio_clear(LED_ORANGE_GPIO)
#define LED_ORANGE_TOGGLE cc2538_gpio_toggle(LED_ORANGE_GPIO)
#define LED2_ON cc2538_gpio_set(LED2_GPIO)
#define LED2_OFF cc2538_gpio_clear(LED2_GPIO)
#define LED2_TOGGLE cc2538_gpio_toggle(LED2_GPIO)
/* Default to red if the color is not specified: */
#define LED_ON LED_RED_ON
#define LED_OFF LED_RED_OFF
#define LED_TOGGLE LED_RED_TOGGLE
#define LED3_ON cc2538_gpio_set(LED3_GPIO)
#define LED3_OFF cc2538_gpio_clear(LED3_GPIO)
#define LED3_TOGGLE cc2538_gpio_toggle(LED3_GPIO)
/** @} */
/**

View File

@ -27,7 +27,9 @@
extern "C" {
#endif
/* for correct inclusion of <msp430.h> */
/**
* @brief Define the CPU model for the <msp430.h>
*/
#ifndef __CC430F6137__
#define __CC430F6137__
#endif
@ -53,18 +55,6 @@ extern "C" {
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
/** @} */
/**
* @brief LED defines for compatibility
* @{
*/
#define LED_RED_ON /* not present */
#define LED_RED_OFF /* not present */
#define LED_RED_TOGGLE /* not present */
#define LED_GREEN_ON /* not present */
#define LED_GREEN_OFF /* not present */
#define LED_GREEN_TOGGLE /* not present */
/** @} */
#ifdef __cplusplus
}
#endif

View File

@ -30,24 +30,29 @@ extern "C" {
#endif
/**
* @name Macros for controlling the on-board LEDs.
* @brief LED pin definitions and handlers
* @{
*/
#define LED_GREEN_PIN 0x08
#define LED_BLUE_PIN 0x04
#define LED_RED_PIN 0x02
#define LED0_PIN GPIO_PIN(5, 7)
#define LED1_PIN GPIO_PIN(5, 2)
#define LED2_PIN GPIO_PIN(5, 1)
#define LED_GREEN_ON GPIO_PORTF_DATA_R |= LED_GREEN_PIN
#define LED_GREEN_OFF GPIO_PORTF_DATA_R &= ~(LED_GREEN_PIN)
#define LED_GREEN_TOGGLE /* not available */
#define LED_PORT (GPIO_PORTF_DATA_R)
#define LED0_MASK (1 << 7)
#define LED1_MASK (1 << 2)
#define LED2_MASK (1 << 1)
#define LED_BLUE_ON GPIO_PORTF_DATA_R |= LED_BLUE_PIN
#define LED_BLUE_OFF GPIO_PORTF_DATA_R &= ~(LED_BLUE_PIN)
#define LED_BLUE_TOGGLE /* not available */
#define LED0_ON (LED_PORT |= LED0_MASK)
#define LED0_OFF (LED_PORT &= ~LED0_MASK)
#define LED0_TOGGLE (LED_PORT ^= LED0_MASK)
#define LED_RED_ON GPIO_PORTF_DATA_R |= LED_RED_PIN
#define LED_RED_OFF GPIO_PORTF_DATA_R &= ~(LED_RED_PIN)
#define LED_RED_TOGGLE /* not available */
#define LED1_ON (LED_PORT |= LED1_MASK)
#define LED1_OFF (LED_PORT &= ~LED1_MASK)
#define LED1_TOGGLE (LED_PORT ^= LED1_MASK)
#define LED2_ON (LED_PORT |= LED2_MASK)
#define LED2_OFF (LED_PORT &= ~LED2_MASK)
#define LED2_TOGGLE (LED_PORT ^= LED2_MASK)
/* @} */
/**

View File

@ -20,44 +20,15 @@
*/
#include "board.h"
static void leds_init(void);
#include "periph/gpio.h"
void board_init(void)
{
/* initialize the boards LEDs, this is done first for debugging purposes */
leds_init();
/* initialize the boards LEDs */
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();
}
/**
* @brief Initialize the boards on-board LEDs (LD4,LD5 and LD6)
*
* The LED initialization is hard-coded in this function. As the LEDs are soldered
* onto the board they are fixed to their CPU pins.
*
* The LEDs are connected to the following pins:
* - LD4: PA 1
* - LD5: PA 3
* - LD6: PA 2
*/
static void leds_init(void)
{
/* enable clock for port GPIOD */
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
/* configure pins as general outputs */
LED_PORT->MODER &= ~(0x000000FC);
LED_PORT->MODER |= 0x00000054;
/* set output speed high-speed */
LED_PORT->OSPEEDR |= 0x000000FC;
/* set output type to push-pull */
LED_PORT->OTYPER &= ~(0x000E);
/* disable pull resistors */
LED_PORT->PUPDR &= ~(0x000000FC);
/* turn all LEDs off */
LED_PORT->BSRRL = 0x00E;
}

View File

@ -30,40 +30,29 @@ extern "C" {
#endif
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PORT_A, 1)
#define LED1_PIN GPIO_PIN(PORT_A, 3)
#define LED2_PIN GPIO_PIN(PORT_A, 2)
#define LED_PORT GPIOA
#define LD4_PIN (1 << 1)
#define LD5_PIN (1 << 3)
#define LD6_PIN (1 << 2)
#define LED0_MASK (1 << 1)
#define LED1_MASK (1 << 3)
#define LED2_MASK (1 << 2)
/** @} */
#define LED0_ON (LED_PORT->BSRRH = LED0_MASK)
#define LED0_OFF (LED_PORT->BSRRL = LED0_MASK)
#define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LD4_ON (LED_PORT->BSRRH = LD4_PIN)
#define LD4_OFF (LED_PORT->BSRRL = LD4_PIN)
#define LD4_TOGGLE (LED_PORT->ODR ^= LD4_PIN)
#define LD5_ON (LED_PORT->BSRRH = LD5_PIN)
#define LD5_OFF (LED_PORT->BSRRL = LD5_PIN)
#define LD5_TOGGLE (LED_PORT->ODR ^= LD5_PIN)
#define LD6_ON (LED_PORT->BSRRH = LD6_PIN)
#define LD6_OFF (LED_PORT->BSRRL = LD6_PIN)
#define LD6_TOGGLE (LED_PORT->ODR ^= LD6_PIN)
#define LED1_ON (LED_PORT->BSRRH = LED1_MASK)
#define LED1_OFF (LED_PORT->BSRRL = LED1_MASK)
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
/* for compatability to other boards */
#define LED_GREEN_ON LD6_ON
#define LED_GREEN_OFF LD6_OFF
#define LED_GREEN_TOGGLE LD6_TOGGLE
#define LED_RED_ON LD5_ON
#define LED_RED_OFF LD5_OFF
#define LED_RED_TOGGLE LD5_TOGGLE
#define LED_ORANGE_ON LD4_ON
#define LED_ORANGE_OFF LD4_OFF
#define LED_ORANGE_TOGGLE LD4_TOGGLE
#define LED2_ON (LED_PORT->BSRRH = LED2_MASK)
#define LED2_OFF (LED_PORT->BSRRL = LED2_MASK)
#define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
/** @} */
/**

View File

@ -19,34 +19,17 @@
*/
#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();
}
/**
* @brief Initialize the boards on-board LEDs
*
* The LEDs initialization is hard-coded in this function. As the LED is soldered
* onto the board it is fixed to its CPU pins.
*
* The LEDs are connected to the following pin:
* - Green: PB12
* - Red: PB10
*/
static void leds_init(void)
{
/* green pin */
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
LED_GREEN_PORT->CR[0] = (0x3 << ((LED_GREEN_PIN-8)*4));
/* red pin */;
LED_RED_PORT->CR[0] = (0x3 << ((LED_RED_PIN-8)*4));
/* initialize the boards LEDs and turn them off */
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_init(LED1_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_set(LED0_PIN);
gpio_set(LED1_PIN);
}

View File

@ -81,32 +81,22 @@ extern "C" {
/** @} */
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PORT (GPIOB)
#define LED_RED_PIN (10)
#define LED_RED_GPIO GPIO_PIN(PORT_B,10)
#define LED_GREEN_PORT (GPIOB)
#define LED_GREEN_PIN (12)
#define LED_GREEN_GPIO GPIO_PIN(PORT_B,12)
/** @} */
#define LED0_PIN GPIO_PIN(PORT_B, 10)
#define LED1_PIN GPIO_PIN(PORT_B, 12)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON (LED_RED_PORT->ODR &= ~(1<<LED_RED_PIN))
#define LED_RED_OFF (LED_RED_PORT->ODR |= (1<<LED_RED_PIN))
#define LED_RED_TOGGLE (LED_RED_PORT->ODR ^= (1<<LED_RED_PIN))
#define LED0_MASK (1 << 10)
#define LED1_MASK (1 << 12)
#define LED_GREEN_ON (LED_GREEN_PORT->ODR &= ~(1<<LED_GREEN_PIN))
#define LED_GREEN_OFF (LED_GREEN_PORT->ODR |= (1<<LED_GREEN_PIN))
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
#define LED0_ON (GPIOB->ODR &= ~LED0_MASK)
#define LED0_OFF (GPIOB->ODR |= LED0_MASK)
#define LED0_TOGGLE (GPIOB->ODR ^= LED0_MASK)
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
#define LED1_ON (GPIOB->ODR &= ~LED1_MASK)
#define LED1_OFF (GPIOB->ODR |= LED1_MASK)
#define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
/** @} */
/**

View File

@ -20,34 +20,18 @@
*/
#include "board.h"
static void leds_init(void);
#include "periph/gpio.h"
void board_init(void)
{
leds_init();
/* initialize the CPU core */
cpu_init();
}
/**
* @brief Initialize the boards on-board RGB-LED
*
*/
static void leds_init(void)
{
/* enable clock */
LED_B_PORT_CLKEN();
LED_G_PORT_CLKEN();
LED_R_PORT_CLKEN();
/* configure pins as gpio */
LED_B_PORT->PCR[LED_B_PIN] = PORT_PCR_MUX(1);
LED_G_PORT->PCR[LED_G_PIN] = PORT_PCR_MUX(1);
LED_R_PORT->PCR[LED_R_PIN] = PORT_PCR_MUX(1);
LED_B_GPIO->PDDR |= (1 << LED_B_PIN);
LED_G_GPIO->PDDR |= (1 << LED_G_PIN);
LED_R_GPIO->PDDR |= (1 << LED_R_PIN);
/* turn all LEDs off */
LED_B_GPIO->PSOR |= (1 << LED_B_PIN);
LED_G_GPIO->PSOR |= (1 << LED_G_PIN);
LED_R_GPIO->PSOR |= (1 << LED_R_PIN);
/* initialize and turn off the on-board RGB-LED */
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);
gpio_set(LED0_PIN);
gpio_set(LED1_PIN);
gpio_set(LED2_PIN);
}

View File

@ -31,44 +31,28 @@ extern "C"
#endif
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_R_PORT_CLKEN() (PORTB_CLOCK_GATE = 1) /**< Clock Enable for PORTD*/
#define LED_G_PORT_CLKEN() (PORTE_CLOCK_GATE = 1) /**< Clock Enable for PORTE*/
#define LED_B_PORT_CLKEN() (PORTB_CLOCK_GATE = 1) /**< Clock Enable for PORTB*/
#define LED_R_PORT PORTB /**< PORT for Red LED*/
#define LED_R_GPIO GPIOB /**< GPIO-Device for Red LED*/
#define LED_G_PORT PORTE /**< PORT for Green LED*/
#define LED_G_GPIO GPIOE /**< GPIO-Device for Green LED*/
#define LED_B_PORT PORTB /**< PORT for Blue LED*/
#define LED_B_GPIO GPIOB /**< GPIO-Device for Blue LED*/
#define LED_R_PIN 22 /**< Red LED connected to PINx*/
#define LED_G_PIN 26 /**< Green LED connected to PINx*/
#define LED_B_PIN 21 /**< Blue LED connected to PINx*/
/** @} */
#define LED0_PIN GPIO_PIN(PORT_B, 22)
#define LED1_PIN GPIO_PIN(PORT_E, 26)
#define LED2_PIN GPIO_PIN(PORT_B, 21)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_B_ON (LED_B_GPIO->PCOR = (1 << LED_B_PIN))
#define LED_B_OFF (LED_B_GPIO->PSOR = (1 << LED_B_PIN))
#define LED_B_TOGGLE (LED_B_GPIO->PTOR = (1 << LED_B_PIN))
#define LED_G_ON (LED_G_GPIO->PCOR = (1 << LED_G_PIN))
#define LED_G_OFF (LED_G_GPIO->PSOR = (1 << LED_G_PIN))
#define LED_G_TOGGLE (LED_G_GPIO->PTOR = (1 << LED_G_PIN))
#define LED_R_ON (LED_R_GPIO->PCOR = (1 << LED_R_PIN))
#define LED_R_OFF (LED_R_GPIO->PSOR = (1 << LED_R_PIN))
#define LED_R_TOGGLE (LED_R_GPIO->PTOR = (1 << LED_R_PIN))
#define LED0_MASK (1 << 22)
#define LED1_MASK (1 << 26)
#define LED2_MASK (1 << 21)
/* for compatability to other boards */
#define LED_GREEN_ON LED_G_ON
#define LED_GREEN_OFF LED_G_OFF
#define LED_GREEN_TOGGLE LED_G_TOGGLE
#define LED_RED_ON LED_R_ON
#define LED_RED_OFF LED_R_OFF
#define LED_RED_TOGGLE LED_R_TOGGLE
#define LED0_ON (GPIOB->PCOR = LED0_MASK)
#define LED0_OFF (GPIOB->PSOR = LED0_MASK)
#define LED0_TOGGLE (GPIOB->PTOR = LED0_MASK)
#define LED1_ON (GPIOE->PCOR = LED1_MASK)
#define LED1_OFF (GPIOE->PSOR = LED1_MASK)
#define LED1_TOGGLE (GPIOE->PTOR = LED1_MASK)
#define LED2_ON (GPIOB->PCOR = LED2_MASK)
#define LED2_OFF (GPIOB->PSOR = LED2_MASK)
#define LED2_TOGGLE (GPIOB->PTOR = LED2_MASK)
/** @} */
/**

View File

@ -19,41 +19,18 @@
*/
#include "board.h"
#include "cpu.h"
static void leds_init(void);
#include "periph/gpio.h"
void board_init(void)
{
/* initialize the CPU */
cpu_init();
/* initialize the boards LEDs */
leds_init();
}
/**
* @brief Initialize the boards on-board LEDs
*
* The LEDs initialization is hard-coded in this function. As the LED is soldered
* onto the board it is fixed to its CPU pins.
*
* The LEDs are connected to the following pin:
* - Green: PB5
* - Orange: PC10
* - Red: PD2
*/
static void leds_init(void)
{
/* green pin */
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
LED_GREEN_PORT->CR[0] = (0x3 << (LED_GREEN_PIN*4));
/* orange pin */
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
LED_ORANGE_PORT->CR[1] = (0x3 << ((LED_ORANGE_PIN-8)*4));
/* red pin */
RCC->APB2ENR |= RCC_APB2ENR_IOPDEN;
LED_RED_PORT->CR[0] = (0x3 << (LED_RED_PIN*4));
/* initialize the boards LEDs and turn them off */
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);
gpio_set(LED0_PIN);
gpio_set(LED1_PIN);
gpio_set(LED2_PIN);
}

View File

@ -108,35 +108,28 @@ extern "C" {
/** @} */
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PORT (GPIOD)
#define LED_RED_PIN (2)
#define LED_RED_GPIO GPIO_PIN(PORT_D,2)
#define LED_GREEN_PORT (GPIOB)
#define LED_GREEN_PIN (5)
#define LED_GREEN_GPIO GPIO_PIN(PORT_B,5)
#define LED_ORANGE_PORT (GPIOC)
#define LED_ORANGE_PIN (10)
#define LED_ORANGE_GPIO GPIO_PIN(PORT_C,10)
/** @} */
#define LED0_PIN GPIO_PIN(PORT_D, 2)
#define LED1_PIN GPIO_PIN(PORT_B, 5)
#define LED2_PIN GPIO_PIN(PORT_C, 10)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON (LED_RED_PORT->ODR &= ~(1<<LED_RED_PIN))
#define LED_RED_OFF (LED_RED_PORT->ODR |= (1<<LED_RED_PIN))
#define LED_RED_TOGGLE (LED_RED_PORT->ODR ^= (1<<LED_RED_PIN))
#define LED0_MASK (1 << 2)
#define LED1_MASK (1 << 5)
#define LED2_MASK (1 << 10)
#define LED_GREEN_ON (LED_GREEN_PORT->ODR &= ~(1<<LED_GREEN_PIN))
#define LED_GREEN_OFF (LED_GREEN_PORT->ODR |= (1<<LED_GREEN_PIN))
#define LED_GREEN_TOGGLE (LED_GREEN_PORT->ODR ^= (1<<LED_GREEN_PIN))
#define LED0_ON (GPIOD->ODR &= ~LED0_MASK)
#define LED0_OFF (GPIOD->ODR |= LED0_MASK)
#define LED0_TOGGLE (GPIOD->ODR ^= LED0_MASK)
#define LED_ORANGE_ON (LED_ORANGE_PORT->ODR &= ~(1<<LED_ORANGE_PIN))
#define LED_ORANGE_OFF (LED_ORANGE_PORT->ODR |= (1<<LED_ORANGE_PIN))
#define LED_ORANGE_TOGGLE (LED_ORANGE_PORT->ODR ^= (1<<LED_ORANGE_PIN))
#define LED1_ON (GPIOB->ODR &= ~LED1_MASK)
#define LED1_OFF (GPIOB->ODR |= LED1_MASK)
#define LED1_TOGGLE (GPIOB->ODR ^= LED1_MASK)
#define LED2_ON (GPIOC->ODR &= ~LED2_MASK)
#define LED2_OFF (GPIOC->ODR |= LED2_MASK)
#define LED2_TOGGLE (GPIOC->ODR ^= LED2_MASK)
/** @} */
/**

View File

@ -33,19 +33,19 @@ static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED(red)",
.pin = LED_RED_GPIO,
.pin = LED0_PIN,
.dir = GPIO_DIR_OUT,
.pull = GPIO_NOPULL,
},
{
.name = "LED(green)",
.pin = LED_GREEN_GPIO,
.pin = LED1_PIN,
.dir = GPIO_DIR_OUT,
.pull = GPIO_NOPULL,
},
{
.name = "LED(orange)",
.pin = LED_ORANGE_GPIO,
.pin = LED2_PIN,
.dir = GPIO_DIR_OUT,
.pull = GPIO_NOPULL,
},

View File

@ -19,40 +19,13 @@
*/
#include "board.h"
#include "cpu.h"
#include "periph/gpio.h"
static void leds_init(void);
void board_init(void)
{
/* initialize the boards LEDs */
leds_init();
gpio_init(LED0_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
/* initialize the CPU */
cpu_init();
}
/**
* @brief Initialize the boards on-board LEDs
*
* The LED initialization is hard-coded in this function.
* As the LED is soldered onto the board it is fixed to
* its CPU pins.
*
* The red LED is connected to pin PC3
*/
static void leds_init(void)
{
/* enable clock for port GPIOC */
RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
/* set output speed to 50MHz */
LED_RED_PORT->OSPEEDR |= GPIO_OSPEEDER_OSPEEDR3;
/* set output type to push-pull */
LED_RED_PORT->OTYPER &= ~(GPIO_OTYPER_OT_3);
/* configure pin as general output */
LED_RED_PORT->MODER &= ~(GPIO_MODER_MODER3);
LED_RED_PORT->MODER |= GPIO_MODER_MODER3_0;
/* disable pull resistors */
LED_RED_PORT->PUPDR &= ~(GPIO_PUPDR_PUPDR3);
/* turn all LEDs off */
LED_RED_PORT->BRR = (1 << 3);
}

View File

@ -31,27 +31,17 @@ extern "C" {
#endif
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_RED_PORT (GPIOC)
#define LED_RED_PIN (3)
#define LED_RED_GPIO GPIO_PIN(PORT_C,3)
/** @} */
#define LED0_PIN GPIO_PIN(PORT_C, 3)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_GREEN_ON
#define LED_GREEN_OFF
#define LED_GREEN_TOGGLE
#define LED_ORANGE_ON
#define LED_ORANGE_OFF
#define LED_ORANGE_TOGGLE
#define LED_RED_ON (LED_RED_PORT->BSRRL = (1 << LED_RED_PIN))
#define LED_RED_OFF (LED_RED_PORT->BSRRH = (1 << LED_RED_PIN))
#define LED_RED_TOGGLE (LED_RED_PORT->ODR ^= (1 << LED_RED_PIN))
#define LED0_PORT (GPIOC)
#define LED0_MASK (1 << 3)
#define LED0_ON (LED0_PORT->BSRRL = LED0_MASK)
#define LED0_OFF (LED0_PORT->BSRRH = LED0_MASK)
#define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK)
/** @} */
/**

View File

@ -48,8 +48,8 @@ void board_init(void)
static void leds_init(void)
{
/* configure LED pins as output */
LED_PORT->FIODIR |= (LED1_PIN | LED2_PIN | LED3_PIN | LED4_PIN);
LED_PORT->FIODIR |= (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK);
/* clear all LEDs */
LED_PORT->FIOCLR = (LED1_PIN | LED2_PIN | LED3_PIN | LED4_PIN);
LED_PORT->FIOCLR = (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK);
}

View File

@ -33,40 +33,32 @@ extern "C" {
#endif
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_PORT LPC_GPIO1
#define LED1_PIN BIT18
#define LED2_PIN BIT20
#define LED3_PIN BIT21
#define LED4_PIN BIT23
/** @} */
#define LED0_PIN GPIO_PIN(1, 18)
#define LED1_PIN GPIO_PIN(1, 20)
#define LED2_PIN GPIO_PIN(1, 21)
#define LED3_PIN GPIO_PIN(1, 23)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED1_ON (LED_PORT->FIOSET = LED1_PIN)
#define LED1_OFF (LED_PORT->FIOCLR = LED1_PIN)
#define LED1_TOGGLE (LED_PORT->FIOPIN ^= LED1_PIN)
#define LED2_ON (LED_PORT->FIOSET = LED2_PIN)
#define LED2_OFF (LED_PORT->FIOCLR = LED2_PIN)
#define LED2_TOGGLE (LED_PORT->FIOPIN ^= LED2_PIN)
#define LED3_ON (LED_PORT->FIOSET = LED3_PIN)
#define LED3_OFF (LED_PORT->FIOCLR = LED3_PIN)
#define LED3_TOGGLE (LED_PORT->FIOPIN ^= LED3_PIN)
#define LED4_ON (LED_PORT->FIOSET = LED4_PIN)
#define LED4_OFF (LED_PORT->FIOCLR = LED4_PIN)
#define LED4_TOGGLE (LED_PORT->FIOPIN ^= LED4_PIN)
#define LED_PORT (LPC_GPIO1)
#define LED0_MASK (BIT18)
#define LED1_MASK (BIT20)
#define LED2_MASK (BIT21)
#define LED3_MASK (BIT23)
/* for compatibility to other boards */
#define LED_GREEN_ON LED1_ON
#define LED_GREEN_OFF LED1_OFF
#define LED_GREEN_TOGGLE LED1_TOGGLE
#define LED_RED_ON LED4_ON
#define LED_RED_OFF LED4_OFF
#define LED_RED_TOGGLE LED4_TOGGLE
#define LED0_ON (LED_PORT->FIOSET = LED0_MASK)
#define LED0_OFF (LED_PORT->FIOCLR = LED0_MASK)
#define LED0_TOGGLE (LED_PORT->FIOPIN ^= LED0_MASK)
#define LED1_ON (LED_PORT->FIOSET = LED1_MASK)
#define LED1_OFF (LED_PORT->FIOCLR = LED1_MASK)
#define LED1_TOGGLE (LED_PORT->FIOPIN ^= LED1_MASK)
#define LED2_ON (LED_PORT->FIOSET = LED2_MASK)
#define LED2_OFF (LED_PORT->FIOCLR = LED2_MASK)
#define LED2_TOGGLE (LED_PORT->FIOPIN ^= LED2_MASK)
#define LED3_ON (LED_PORT->FIOSET = LED3_MASK)
#define LED3_OFF (LED_PORT->FIOCLR = LED3_MASK)
#define LED3_TOGGLE (LED_PORT->FIOPIN ^= LED3_MASK)
/** @} */
/**

View File

@ -21,7 +21,7 @@
#include <stdint.h>
#include <string.h>
#include "board-conf.h"
#include "board.h"
#include "config.h"
#include "flashrom.h"

View File

@ -199,8 +199,6 @@ void board_init(void)
msp430_cpu_init();
msb_ports_init();
LED_RED_ON;
msp430_set_cpu_speed(CLOCK_CORECLOCK);
/* finally initialize STDIO over UART */

View File

@ -1,37 +0,0 @@
/*
* Copyright (C) 2013 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup boards_msb430-common MSB-430 common
* @ingroup boards
* @brief Common files for all MSB-430 boards
* @{
*
* @file
* @brief Common definitions for all msb-430 based boards
*
* @author unknown
*/
#ifndef BOARD_CONF_H_
#define BOARD_CONF_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define INFOMEM (0x1000)
#ifdef __cplusplus
}
#endif
#endif /* BOARD-CONF_H */
/** @} */

View File

@ -0,0 +1,66 @@
/*
* Copyright (C) 2013-2016 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup boards_msb430-common MSB-430 common
* @ingroup boards
* @brief Common files for all MSB-430 boards
* @{
*
* @file
* @brief Common definitions for all msb-430 based boards
*
* @author unknown
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef BOARD_COMMON_H_
#define BOARD_COMMON_H_
#include "cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Address of the info memory
*/
#define INFOMEM (0x1000)
/**
* @brief Xtimer configuration
* @{
*/
#define XTIMER (0)
#define XTIMER_CHAN (0)
#define XTIMER_MASK (0xffff0000)
#define XTIMER_SHIFT_ON_COMPARE (4)
#define XTIMER_BACKOFF (40)
/** @} */
/**
* @brief LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(4, 7)
#define LED_OUT_REG (P5OUT)
#define LED0_MASK (1 << 7)
#define LED0_ON (LED_OUT_REG &= ~LED0_MASK)
#define LED0_OFF (LED_OUT_REG |= LED0_MASK)
#define LED0_TOGGLE (LED_OUT_REG ^= LED0_MASK)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* BOARD-CONF_H */
/** @} */

View File

@ -34,58 +34,35 @@
#ifndef MSB_BOARD_H_
#define MSB_BOARD_H_
#include "board-conf.h"
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* for correct inclusion of <msp430.h> */
/**
* @brief Define the CPU model for the <msp430.h>
*/
#ifndef __MSP430F1612__
#define __MSP430F1612__
#endif
/**
* @brief Xtimer configuration
* @brief CPU core configuration
*
* @todo Move this to the periph_conf.h
* @{
*/
#define XTIMER (0)
#define XTIMER_CHAN (0)
#define XTIMER_MASK (0xffff0000)
#define XTIMER_SHIFT_ON_COMPARE (4)
#define XTIMER_BACKOFF (40)
/** @} */
/* MSB430 core */
#define MSP430_INITIAL_CPU_SPEED 2457600uL
#define F_CPU MSP430_INITIAL_CPU_SPEED
#define F_RC_OSCILLATOR 32768
#define MSP430_HAS_DCOR 1
#define MSP430_HAS_EXTERNAL_CRYSTAL 0
/**
* @brief LED definitions
* @{
*/
#define LEDS_PxDIR (P5DIR)
#define LEDS_PxOUT (P5OUT)
#define LEDS_CONF_RED (0x80)
#define LEDS_CONF_GREEN (0x00)
#define LEDS_CONF_YELLOW (0x00)
#define LED_RED_ON (LEDS_PxOUT &=~LEDS_CONF_RED)
#define LED_RED_OFF (LEDS_PxOUT |= LEDS_CONF_RED)
#define LED_RED_TOGGLE (LEDS_PxOUT ^= LEDS_CONF_RED)
#define LED_GREEN_ON /* not present */
#define LED_GREEN_OFF /* not present */
#define LED_GREEN_TOGGLE /* not present */
/** @} */
#ifdef __cplusplus
}
#endif
#include "board-conf.h"
/** @} */
#endif /* MSB_BOARD_H_ */

View File

@ -22,56 +22,35 @@
#ifndef MSB_BOARD_H_
#define MSB_BOARD_H_
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/* for correct inclusion of <msp430.h> */
/**
* @brief Define the CPU model for the <msp430.h>
*/
#ifndef __MSP430F1612__
#define __MSP430F1612__
#endif
/**
* @brief Xtimer configuration
* @brief CPU core configuration
*
* @todo Move this to the periph_conf.h
* @{
*/
#define XTIMER (0)
#define XTIMER_CHAN (0)
#define XTIMER_MASK (0xffff0000)
#define XTIMER_SHIFT_ON_COMPARE (4)
#define XTIMER_BACKOFF (40)
/** @} */
//MSB430 core
#define MSP430_INITIAL_CPU_SPEED 7372800uL
#define F_CPU MSP430_INITIAL_CPU_SPEED
#define F_RC_OSCILLATOR 32768
#define MSP430_HAS_DCOR 1
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
/**
* @brief LED definitions
* @{
*/
#define LEDS_PxDIR (P5DIR)
#define LEDS_PxOUT (P5OUT)
#define LEDS_CONF_RED (0x80)
#define LEDS_CONF_GREEN (0x00)
#define LEDS_CONF_YELLOW (0x00)
#define LED_RED_ON (LEDS_PxOUT &=~LEDS_CONF_RED)
#define LED_RED_OFF (LEDS_PxOUT |= LEDS_CONF_RED)
#define LED_RED_TOGGLE (LEDS_PxOUT ^= LEDS_CONF_RED)
#define LED_GREEN_ON /* not present */
#define LED_GREEN_OFF /* not present */
#define LED_GREEN_TOGGLE /* not present */
/** @} */
#ifdef __cplusplus
}
#endif
#include "board-conf.h"
/** @} */
#endif /* MSB_BOARD_H_ */

View File

@ -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)

View File

@ -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)
/** @} */
/**

View File

@ -49,28 +49,29 @@ extern "C" {
/** @} */
/**
* @name LED pin definitions
* @brief LED pin definitions and handlers
* @{
*/
#define LED_PORT GPIOB
#define LED_RED_PIN (1 << 8)
#define LED_YELLOW_PIN (1 << 14)
#define LED_GREEN_PIN (1 << 15)
/** @} */
#define LED0_PIN GPIO_PIN(1, 8)
#define LED1_PIN GPIO_PIN(1, 14)
#define LED2_PIN GPIO_PIN(1, 15)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON (LED_PORT->BSRRH = LED_RED_PIN)
#define LED_RED_OFF (LED_PORT->BSRRL = LED_RED_PIN)
#define LED_RED_TOGGLE (LED_PORT->ODR ^= LED_RED_PIN)
#define LED_YELLOW_ON (LED_PORT->BSRRH = LED_YELLOW_PIN)
#define LED_YELLOW_OFF (LED_PORT->BSRRL = LED_YELLOW_PIN)
#define LED_YELLOW_TOGGLE (LED_PORT->ODR ^= LED_YELLOW_PIN)
#define LED_GREEN_ON (LED_PORT->BSRRH = LED_GREEN_PIN)
#define LED_GREEN_OFF (LED_PORT->BSRRL = LED_GREEN_PIN)
#define LED_GREEN_TOGGLE (LED_PORT->ODR ^= LED_GREEN_PIN)
#define LED_PORT GPIOB
#define LED0_MASK (1 << 8)
#define LED1_MASK (1 << 14)
#define LED2_MASK (1 << 15)
#define LED0_ON (LED_PORT->BSRRH = LED0_MASK)
#define LED0_OFF (LED_PORT->BSRRL = LED0_MASK)
#define LED0_TOGGLE (LED_PORT->ODR ^= LED0_MASK)
#define LED1_ON (LED_PORT->BSRRH = LED1_MASK)
#define LED1_OFF (LED_PORT->BSRRL = LED1_MASK)
#define LED1_TOGGLE (LED_PORT->ODR ^= LED1_MASK)
#define LED2_ON (LED_PORT->BSRRH = LED2_MASK)
#define LED2_OFF (LED_PORT->BSRRL = LED2_MASK)
#define LED2_TOGGLE (LED_PORT->ODR ^= LED2_MASK)
/** @} */
/**

View File

@ -38,15 +38,6 @@ static nvram_spi_params_t nvram_spi_params = {
.address_count = MULLE_NVRAM_SPI_ADDRESS_COUNT,
};
/**
* @brief Initialize the boards on-board LEDs
*
* The LEDs are initialized here in order to be able to use them in the early
* boot for diagnostics.
*
*/
static inline void leds_init(void);
/** @brief Initialize the GPIO pins controlling the power switches. */
static inline void power_pins_init(void);
@ -67,8 +58,11 @@ static int mulle_nvram_init(void);
void board_init(void)
{
int status;
/* initialize the boards LEDs, this is done first for debugging purposes */
leds_init();
/* initialize the boards LEDs */
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 power control pins */
power_pins_init();
@ -85,8 +79,6 @@ void board_init(void)
/* Turn on AVDD for reading voltages */
gpio_set(MULLE_POWER_AVDD);
LED_RED_ON;
/* Initialize RTC oscillator as early as possible since we are using it as a
* base clock for the FLL.
* It takes a while to stabilize the oscillator, therefore we do this as
@ -119,8 +111,6 @@ void board_init(void)
/* initialize the CPU */
cpu_init();
LED_YELLOW_ON;
/* NVRAM requires xtimer for timing */
xtimer_init();
@ -130,23 +120,6 @@ void board_init(void)
/* Increment boot counter */
increase_boot_count();
}