Private
Public Access
2
0

iot2050: Add USER button

A simple GPIO, no muxing needed, no pulling supported. Therefore, reject
any mode changes that request pull up/down, ignore the others.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka
2021-01-18 09:14:35 +01:00
committed by Tom Ingleby
parent a9f0ff22e8
commit 8b1c54934e
2 changed files with 25 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ extern "C" {
#include "mraa_internal.h"
#define PLATFORM_NAME "SIMATIC IOT2050"
#define MRAA_IOT2050_PINCOUNT (20)
#define MRAA_IOT2050_PINCOUNT 21
mraa_board_t *
mraa_siemens_iot2050();

View File

@@ -154,6 +154,11 @@ iot2050_gpio_mode_replace(mraa_gpio_context dev, mraa_gpio_mode_t mode)
ret = MRAA_ERROR_INVALID_RESOURCE;
goto failed;
}
/* Handle mode changes for interface pins without pull pin */
if (pull_en_pins[dev->phy_pin] == -1) {
return (mode == MRAA_GPIO_STRONG || mode == MRAA_GPIO_HIZ) ?
MRAA_SUCCESS : MRAA_ERROR_FEATURE_NOT_IMPLEMENTED;
}
info = iot2050_get_regmux_by_pinmap(dev->pin);
pull_en_pin = mraa_gpio_init_raw(pull_en_pins[dev->phy_pin]);
if(pull_en_pin == NULL) {
@@ -1207,6 +1212,25 @@ mraa_siemens_iot2050()
iot2050_pin_add_aio(b, pin_index, 5, mux_info, 5);
pin_index++;
iot2050_setup_pins(b, pin_index, "USER",
(mraa_pincapabilities_t) {
1, /*valid*/
1, /*gpio*/
0, /*pwm*/
0, /*fast gpio*/
0, /*spi*/
0, /*i2c*/
0, /*aio*/
0}, /*uart*/
(regmux_info_t) {
-1,
-1,
wkup_gpio0_base+25,
{}
});
iot2050_pin_add_gpio(b, pin_index, wkup_gpio0_chip, 25, -1, -1, NULL, 0);
pin_index++;
/* UART */
iot2050_setup_uart(b, "UART0", "/dev/ttyS1", "IO0", "IO1", "IO2", "IO3");
b->def_uart_dev = 0;