From 77c2e94288cf98ce8b6074e498703fc5d421e07a Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Sat, 28 Sep 2019 19:03:19 +0200 Subject: [PATCH] boards/ek-lm4f120xl: provide SAUL configuration This adds a SAUL configuration for the buttons and LEDs on the board. --- boards/ek-lm4f120xl/Makefile.dep | 3 + boards/ek-lm4f120xl/include/board.h | 15 ++++- boards/ek-lm4f120xl/include/gpio_params.h | 68 +++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 boards/ek-lm4f120xl/Makefile.dep create mode 100644 boards/ek-lm4f120xl/include/gpio_params.h diff --git a/boards/ek-lm4f120xl/Makefile.dep b/boards/ek-lm4f120xl/Makefile.dep new file mode 100644 index 0000000000..5472bf8b8d --- /dev/null +++ b/boards/ek-lm4f120xl/Makefile.dep @@ -0,0 +1,3 @@ +ifneq (,$(filter saul_default,$(USEMODULE))) + USEMODULE += saul_gpio +endif diff --git a/boards/ek-lm4f120xl/include/board.h b/boards/ek-lm4f120xl/include/board.h index 8a2ff1d353..adad110abe 100644 --- a/boards/ek-lm4f120xl/include/board.h +++ b/boards/ek-lm4f120xl/include/board.h @@ -27,13 +27,24 @@ extern "C" { #endif +/** + * @name Button pin definitions + * @{ + */ +#define BTN0_PIN GPIO_PIN(5, 4) +#define BTN1_PIN GPIO_PIN(5, 0) + +#define BTN0_MODE GPIO_IN_PU +#define BTN1_MODE GPIO_IN_PU +/** @} */ + /** * @name LED pin definitions and handlers * @{ */ -#define LED0_PIN GPIO_PIN(5, 7) +#define LED0_PIN GPIO_PIN(5, 1) #define LED1_PIN GPIO_PIN(5, 2) -#define LED2_PIN GPIO_PIN(5, 1) +#define LED2_PIN GPIO_PIN(5, 3) #define LED_PORT (GPIO_PORTF_DATA_R) #define LED0_MASK (1 << 7) diff --git a/boards/ek-lm4f120xl/include/gpio_params.h b/boards/ek-lm4f120xl/include/gpio_params.h new file mode 100644 index 0000000000..071e80e740 --- /dev/null +++ b/boards/ek-lm4f120xl/include/gpio_params.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2019 Benjamin Valentin + * + * 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. + */ + +/** + * @ingroup boards_ek-lm4f120xl + * @{ + * + * @file + * @brief Board specific configuration of direct mapped GPIOs + * + * @author Benjamin Valentin + */ + +#ifndef GPIO_PARAMS_H +#define GPIO_PARAMS_H + +#include "board.h" +#include "saul/periph.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief GPIO pin configuration + */ +static const saul_gpio_params_t saul_gpio_params[] = +{ + { + .name = "LED (red)", + .pin = LED0_PIN, + .mode = GPIO_OUT, + }, + { + .name = "LED (blue)", + .pin = LED1_PIN, + .mode = GPIO_OUT, + }, + { + .name = "LED (green)", + .pin = LED2_PIN, + .mode = GPIO_OUT, + }, + { + .name = "Button (SW0)", + .pin = BTN0_PIN, + .mode = BTN0_MODE, + .flags = SAUL_GPIO_INVERTED, + }, + { + .name = "Button (SW1)", + .pin = BTN1_PIN, + .mode = BTN1_MODE, + .flags = SAUL_GPIO_INVERTED, + }, +}; + +#ifdef __cplusplus +} +#endif + +#endif /* GPIO_PARAMS_H */ +/** @} */