1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/atmega_common: Make GPIO_DISCONNECT alias for GPIO_INPUT

Since on ATmega GPIOs cannot be disconnected and the reset state is
them being an input, this may help making code more portable.
This commit is contained in:
Marian Buschsieweke 2024-01-23 09:05:40 +01:00
parent bd3f54ac8f
commit f3bd3476ee
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6
2 changed files with 12 additions and 3 deletions

View File

@ -231,6 +231,16 @@ typedef enum {
GPIO_TRIGGER_LEVEL_HIGH = 0xff, /**< not supported */
} gpio_irq_trig_t;
#define HAVE_GPIO_STATE_T
typedef enum {
GPIO_INPUT,
GPIO_OUTPUT_PUSH_PULL,
GPIO_OUTPUT_OPEN_DRAIN, /**< not supported */
GPIO_OUTPUT_OPEN_SOURCE, /**< not supported */
GPIO_USED_BY_PERIPHERAL, /**< not supported */
GPIO_DISCONNECT = GPIO_INPUT,
} gpio_state_t;
#define HAVE_GPIO_LL_PREPARE_WRITE_ALL_PINS
#define HAVE_GPIO_LL_PREPARE_WRITE

View File

@ -40,7 +40,7 @@ static void _set_dir(gpio_port_t port, uint8_t pin, bool output)
p->ddr |= 1U << pin;
}
else {
p-> ddr &= ~(1U << pin);
p->ddr &= ~(1U << pin);
}
}
@ -59,8 +59,7 @@ static void _set_pull_config(gpio_port_t port, uint8_t pin, gpio_pull_t pull)
int gpio_ll_init(gpio_port_t port, uint8_t pin, gpio_conf_t conf)
{
if ((conf.pull > GPIO_PULL_UP)
|| (conf.state == GPIO_OUTPUT_OPEN_DRAIN)
|| (conf.state == GPIO_OUTPUT_OPEN_SOURCE)) {
|| (conf.state > GPIO_OUTPUT_PUSH_PULL)) {
return -ENOTSUP;
}