From: Keith Packard Date: Sun, 13 Nov 2022 03:38:56 +0000 (-0800) Subject: fixup for exti restore X-Git-Tag: 1.9.13~1^2~26^2~12 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=c450b5cd80534d067a760e5f0768f39a20604761 fixup for exti restore Signed-off-by: Keith Packard --- 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) {