Skip to content

Commit

Permalink
cpu/sam0_common: Implement gpio_ll_switch_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
maribu committed Feb 5, 2024
1 parent 8aab69e commit 06a0537
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions cpu/sam0_common/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FEATURES_PROVIDED += periph_gpio_ll_irq
FEATURES_PROVIDED += periph_gpio_ll_irq_level_triggered_high
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_i2c_reconfigure
FEATURES_PROVIDED += periph_rtt_overflow
FEATURES_PROVIDED += periph_rtt_set_counter
Expand Down
12 changes: 12 additions & 0 deletions cpu/sam0_common/include/gpio_ll_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ static inline void gpio_ll_write(gpio_port_t port, uword_t mask)
p->OUT.reg = mask;
}

static inline void gpio_ll_switch_dir_output(gpio_port_t port, uword_t outputs)
{
PortGroup *p = (PortGroup *)port;
p->DIRSET.reg = outputs;
}

static inline void gpio_ll_switch_dir_input(gpio_port_t port, uword_t inputs)
{
PortGroup *p = (PortGroup *)port;
p->DIRCLR.reg = inputs;
}

static inline gpio_port_t gpio_get_port(gpio_t pin)
{
return (gpio_port_t)(pin & ~(0x1f));
Expand Down

0 comments on commit 06a0537

Please sign in to comment.