Skip to content

Commit

Permalink
metro-snek: Mask in unchanged pincfg bits instead of changed bits
Browse files Browse the repository at this point in the history
When modifying pincfg bits, use the provided mask as a set of bits to
clear from the old value, leaving all other bits unchanged.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Apr 12, 2019
1 parent 9516c0f commit 79b525a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion metro-snek/samd21.h
Expand Up @@ -412,7 +412,7 @@ samd21_port_dir_set(struct samd21_port *port, uint8_t pin, uint8_t dir)
static inline void
samd21_port_pincfg_set(struct samd21_port *port, uint8_t pin, uint8_t pincfg_mask, uint8_t pincfg)
{
port->pincfg[pin] = (port->pincfg[pin] & pincfg_mask) | pincfg;
port->pincfg[pin] = (port->pincfg[pin] & ~pincfg_mask) | pincfg;
}

static inline uint8_t
Expand Down

0 comments on commit 79b525a

Please sign in to comment.