Merge pull request #12326 from benpicco/saul_ek-lm4f120xl

boards/ek-lm4f120xl: provide SAUL configuration
This commit is contained in:
Leandro Lanzieri 2019-10-02 11:02:20 +02:00 committed by GitHub
commit 3acb63d3f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 2 deletions

View File

@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif

View File

@ -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)

View File

@ -0,0 +1,68 @@
/*
* Copyright (C) 2019 Benjamin Valentin <benpicco@googlemail.com>
*
* 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 <benpicco@googlemail.com>
*/
#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 */
/** @} */