1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

cpu/atmega_common: implement gpio_ll_switch_dir

This commit is contained in:
Marian Buschsieweke 2024-01-22 17:06:10 +01:00
parent 6fb369d4fc
commit c011764022
No known key found for this signature in database
GPG Key ID: 77AA882EC78084E6
2 changed files with 17 additions and 0 deletions

View File

@ -12,6 +12,7 @@ FEATURES_PROVIDED += periph_gpio_ll_input_pull_up
FEATURES_PROVIDED += periph_gpio_ll_irq
FEATURES_PROVIDED += periph_gpio_ll_irq_level_triggered_low
FEATURES_PROVIDED += periph_gpio_ll_irq_unmask
FEATURES_PROVIDED += periph_gpio_ll_switch_dir
FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += periph_rtc_ms
FEATURES_PROVIDED += periph_rtt_overflow

View File

@ -184,6 +184,22 @@ static inline uword_t gpio_ll_prepare_write(gpio_port_t port, uword_t mask,
return result;
}
static inline void gpio_ll_switch_dir_output(gpio_port_t port, uword_t outputs)
{
unsigned irq_state = irq_disable();
atmega_gpio_port_t *p = (void *)port;
p->ddr |= outputs;
irq_restore(irq_state);
}
static inline void gpio_ll_switch_dir_input(gpio_port_t port, uword_t inputs)
{
unsigned irq_state = irq_disable();
atmega_gpio_port_t *p = (void *)port;
p->ddr &= ~(inputs);
irq_restore(irq_state);
}
static inline gpio_port_t gpio_port_pack_addr(void *addr)
{
return (gpio_port_t)addr;