From c450b5cd80534d067a760e5f0768f39a20604761 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 12 Nov 2022 19:38:56 -0800 Subject: [PATCH] fixup for exti restore Signed-off-by: Keith Packard --- src/samd21/samd21.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/samd21/samd21.h b/src/samd21/samd21.h index 747f3ad5..b101c6b9 100644 --- a/src/samd21/samd21.h +++ b/src/samd21/samd21.h @@ -777,6 +777,16 @@ samd21_port_pmux_set(struct samd21_port *port, uint8_t pin, uint8_t func) (1 << SAMD21_PORT_PINCFG_PMUXEN)); } +static inline uint8_t +samd21_port_pmux_get(struct samd21_port *port, uint8_t pin) +{ + uint8_t byte = pin >> 1; + uint8_t bit = (pin & 1) << 2; + uint8_t mask = 0xf << bit; + uint8_t value = (uint8_t) ((port->pmux[byte] & mask) >> bit); + return value; +} + static inline void samd21_port_pmux_clr(struct samd21_port *port, uint8_t pin) { -- 2.30.2