1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

saul/gpio: add support to initialized state

This commit is contained in:
Gaëtan Harter 2017-09-08 13:58:47 +02:00
parent 05402dea29
commit c39f4d8317
3 changed files with 8 additions and 2 deletions

BIN
drivers/.Makefile.dep.swo Normal file

Binary file not shown.

View File

@ -34,8 +34,8 @@ extern "C" {
#ifdef MODULE_SAUL_GPIO
typedef enum {
SAUL_GPIO_INVERTED = (1 << 0), /**< pin is used as inverted */
SAUL_GPIO_INIT_CLEAR = 1 << 1, /**< set pin inactive after initialization */
SAUL_GPIO_INIT_SET = 1 << 2, /**< set pin active after initialization */
SAUL_GPIO_INIT_CLEAR = (1 << 1), /**< set pin inactive after init */
SAUL_GPIO_INIT_SET = (1 << 2), /**< set pin active after init */
} saul_gpio_flags_t;
/**

View File

@ -66,6 +66,12 @@ void auto_init_gpio(void)
}
/* initialize the GPIO pin */
gpio_init(p->pin, p->mode);
/* set initial pin state if configured */
if (p->flags & (SAUL_GPIO_INIT_CLEAR | SAUL_GPIO_INIT_SET)) {
phydat_t s;
s.val[0] = (p->flags & SAUL_GPIO_INIT_SET);
saul_reg_entries[i].driver->write(p, &s);
}
/* add to registry */
saul_reg_add(&(saul_reg_entries[i]));
}