diff --git a/boards/pic32-wifire/include/board.h b/boards/pic32-wifire/include/board.h index eaf2f46127..eeed209d33 100644 --- a/boards/pic32-wifire/include/board.h +++ b/boards/pic32-wifire/include/board.h @@ -47,6 +47,37 @@ extern "C" { */ #define EIC_IRQ (1) +/** + * @brief LED pin configuration + * @{ + */ +#define LED1_PIN GPIO_PIN(PORT_G, 6) +#define LED2_PIN GPIO_PIN(PORT_D, 4) +#define LED3_PIN GPIO_PIN(PORT_B, 11) +#define LED4_PIN GPIO_PIN(PORT_G, 15) + +#define LED1_MASK (1 << 6) +#define LED2_MASK (1 << 4) +#define LED3_MASK (1 << 11) +#define LED4_MASK (1 << 15) + +#define LED1_ON (LATGSET = LED1_MASK) +#define LED1_OFF (LATGCLR = LED1_MASK) +#define LED1_TOGGLE (LATGINV = LED1_MASK) + +#define LED2_ON (LATDSET = LED2_MASK) +#define LED2_OFF (LATDCLR = LED2_MASK) +#define LED2_TOGGLE (LATDINV = LED2_MASK) + +#define LED3_ON (LATBSET = LED3_MASK) +#define LED3_OFF (LATBCLR = LED3_MASK) +#define LED3_TOGGLE (LATBINV = LED3_MASK) + +#define LED4_ON (LATGSET = LED4_MASK) +#define LED4_OFF (LATGCLR = LED4_MASK) +#define LED4_TOGGLE (LATGINV = LED4_MASK) +/** @} */ + /** * @brief Board level initialisation */ diff --git a/boards/pic32-wifire/wifire.c b/boards/pic32-wifire/wifire.c index 96d97c8769..4d29c8a513 100644 --- a/boards/pic32-wifire/wifire.c +++ b/boards/pic32-wifire/wifire.c @@ -10,6 +10,7 @@ #include #include +#include "periph/gpio.h" #include "periph/uart.h" #include "bitarithm.h" #include "board.h" @@ -30,6 +31,16 @@ 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); + gpio_init(LED3_PIN, GPIO_OUT); + gpio_init(LED4_PIN, GPIO_OUT); + LED1_OFF; + LED2_OFF; + LED3_OFF; + LED4_OFF; + /* Stop the linker from throwing away the PIC32 config register settings */ dummy(); }