boards: pic32-clicker: Add LEDs support

Signed-off-by: Francois Berder <fberder@outlook.fr>
This commit is contained in:
Francois Berder 2017-05-05 13:42:29 +02:00
parent 472eeb0068
commit ed6dc701b2
2 changed files with 26 additions and 0 deletions

View File

@ -9,6 +9,7 @@
*/
#include <stdio.h>
#include <stdint.h>
#include "periph/gpio.h"
#include "periph/uart.h"
#include "bitarithm.h"
#include "board.h"
@ -29,6 +30,12 @@ void board_init(void)
uart_init(DEBUG_VIA_UART, DEBUG_UART_BAUD, NULL, 0);
#endif
/* Turn off all LED's */
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
LED1_OFF;
LED2_OFF;
/* Stop the linker from throwing away the PIC32 config register settings */
dummy();
}

View File

@ -47,6 +47,25 @@ extern "C" {
*/
#define EIC_IRQ (1)
/**
* @brief LED pin configuration
* @{
*/
#define LED1_PIN GPIO_PIN(PORT_B, 1)
#define LED2_PIN GPIO_PIN(PORT_B, 2)
#define LED1_MASK (1 << 1)
#define LED2_MASK (1 << 2)
#define LED1_ON (LATBSET = LED1_MASK)
#define LED1_OFF (LATBCLR = LED1_MASK)
#define LED1_TOGGLE (LATBINV = LED1_MASK)
#define LED2_ON (LATBSET = LED2_MASK)
#define LED2_OFF (LATBCLR = LED2_MASK)
#define LED2_TOGGLE (LATBINV = LED2_MASK)
/** @} */
/**
* @brief Board level initialisation
*/