X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsamd21%2Fsamd21.h;h=b101c6b9f3e97c100d803a3c3d938f88a254bb56;hb=c450b5cd80534d067a760e5f0768f39a20604761;hp=747f3ad5f8df52652c5d2321b8b9d37ad883d7ad;hpb=c82b214e34763e0206cd676cae2d82e735ef2576;p=fw%2Faltos 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) {