fixup for exti restore
authorKeith Packard <keithp@keithp.com>
Sun, 13 Nov 2022 03:38:56 +0000 (19:38 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 13 Nov 2022 03:38:56 +0000 (19:38 -0800)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/samd21/samd21.h

index 747f3ad5f8df52652c5d2321b8b9d37ad883d7ad..b101c6b9f3e97c100d803a3c3d938f88a254bb56 100644 (file)
@@ -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)
 {