Browse Source

boards: pic32-clicker: Add LEDs support

Signed-off-by: Francois Berder <fberder@outlook.fr>
master
Francois Berder 6 years ago
parent
commit
ed6dc701b2
  1. 7
      boards/pic32-clicker/clicker.c
  2. 19
      boards/pic32-clicker/include/board.h

7
boards/pic32-clicker/clicker.c

@ -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();
}

19
boards/pic32-clicker/include/board.h

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

Loading…
Cancel
Save