/* The following functions calculate from the pin number the register and the bit offset that we should access.  */
static uint32_t gpio_mux_reg(gpio_pin_t pin)
/* The following functions calculate from the pin number the register and the bit offset that we should access.  */
static uint32_t gpio_mux_reg(gpio_pin_t pin)
{
    pin %= BANK_BOUNDARY;
    uint32_t bank = pin / PINS_PER_BANK;
    uint32_t offset = bank * BANK_MEM_SIZE;
    offset += MUX_REGS_OFFSET;
    offset += pin % PINS_PER_BANK / MUX_PINS_PER_REG * 0x04;
    return round_down(offset, 4);
}