Skip to content

Commit

Permalink
iot2050: Add USER button
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jan-kiszka authored and tingleby committed Aug 5, 2022
1 parent a9f0ff2 commit 8b1c549
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/arm/siemens/iot2050.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
24 changes: 24 additions & 0 deletions src/arm/siemens/iot2050.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8b1c549

Please sign in to comment.