Skip to content

Commit

Permalink
boards/ek-lm4f120xl: provide SAUL configuration
Browse files Browse the repository at this point in the history
This adds a SAUL configuration for the buttons and LEDs on the board.
  • Loading branch information
benpicco committed Sep 28, 2019
1 parent 8de39d8 commit 77c2e94
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 2 deletions.
3 changes: 3 additions & 0 deletions boards/ek-lm4f120xl/Makefile.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
15 changes: 13 additions & 2 deletions boards/ek-lm4f120xl/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
68 changes: 68 additions & 0 deletions boards/ek-lm4f120xl/include/gpio_params.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (C) 2019 Benjamin Valentin <[email protected]>
*
* 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 <[email protected]>
*/

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

0 comments on commit 77c2e94

Please sign in to comment.