boards/udoo: cleaned up LED handling
This commit is contained in:
parent
593ad5b223
commit
007f717f2c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2014 Freie Universität Berlin
|
* Copyright (C) 2014-2016 Freie Universität Berlin
|
||||||
*
|
*
|
||||||
* This file is subject to the terms and conditions of the GNU Lesser
|
* 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
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
@ -18,43 +18,14 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "cpu.h"
|
||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "periph/gpio.h"
|
||||||
|
|
||||||
void led_init(void);
|
|
||||||
|
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
/* initialize the CPU */
|
/* initialize the CPU */
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
/* initialize the on-board Amber "L" LED @ pin PB27 */
|
||||||
/* initialize the boards LEDs */
|
gpio_init(LED_PIN, GPIO_DIR_OUT, GPIO_NOPULL);
|
||||||
led_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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)
|
|
||||||
{
|
|
||||||
/* enable PIO control of pin PD27 */
|
|
||||||
LED_PORT->PIO_PER = LED_PIN;
|
|
||||||
/* set pin as output */
|
|
||||||
LED_PORT->PIO_OER = LED_PIN;
|
|
||||||
/* enable direct write access to the LED pin */
|
|
||||||
LED_PORT->PIO_OWER = LED_PIN;
|
|
||||||
/* disable pull-up */
|
|
||||||
LED_PORT->PIO_PUDR = LED_PIN;
|
|
||||||
/* clear pin */
|
|
||||||
LED_PORT->PIO_CODR = LED_PIN;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,16 +33,17 @@ extern "C" {
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_PORT PIOB
|
#define LED_PORT PIOB
|
||||||
#define LED_PIN PIO_PB27
|
#define LED_BIT PIO_PB27
|
||||||
|
#define LED_PIN GPIO_PIN(PB, 27)
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Macros for controlling the on-board LEDs.
|
* @name Macros for controlling the on-board LEDs.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LED_ON LED_PORT->PIO_ODSR |= LED_PIN
|
#define LED_ON (LED_PORT->PIO_SODR = LED_BIT)
|
||||||
#define LED_OFF LED_PORT->PIO_ODSR &= ~LED_PIN
|
#define LED_OFF (LED_PORT->PIO_CODR = LED_BIT)
|
||||||
#define LED_TOGGLE LED_PORT->PIO_ODSR ^= LED_PIN;
|
#define LED_TOGGLE (LED_PORT->PIO_ODSR ^= LED_BIT)
|
||||||
|
|
||||||
/* for compatability to other boards */
|
/* for compatability to other boards */
|
||||||
#define LED_GREEN_ON LED_ON
|
#define LED_GREEN_ON LED_ON
|
||||||
@ -53,7 +54,6 @@ extern "C" {
|
|||||||
#define LED_RED_TOGGLE /* not available */
|
#define LED_RED_TOGGLE /* not available */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user