diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-12-25 10:33:24 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-01-07 19:30:17 -0500 |
commit | 5b91c7a68d958b08227538ac99cb74e5ae7283e4 (patch) | |
tree | 90f319ba03c1322526ceb25a0ee2419968c81455 /src/sam3x8e/gpio.c | |
parent | ecba3e9a19236c04e93ff102bc5cde55fdc906ad (diff) | |
download | kutter-5b91c7a68d958b08227538ac99cb74e5ae7283e4.tar.gz kutter-5b91c7a68d958b08227538ac99cb74e5ae7283e4.tar.xz kutter-5b91c7a68d958b08227538ac99cb74e5ae7283e4.zip |
sam3x8e: Pass the gpio id directly to gpio_peripheral()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/sam3x8e/gpio.c')
-rw-r--r-- | src/sam3x8e/gpio.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sam3x8e/gpio.c b/src/sam3x8e/gpio.c index 2311d41f..b12dc447 100644 --- a/src/sam3x8e/gpio.c +++ b/src/sam3x8e/gpio.c @@ -24,14 +24,15 @@ static Pio * const digital_regs[] = { ****************************************************************/ void -gpio_peripheral(char bank, uint32_t bit, char ptype, uint32_t pull_up) +gpio_peripheral(uint32_t gpio, char ptype, int32_t pull_up) { - Pio *regs = digital_regs[bank - 'A']; + uint32_t bank = GPIO2PORT(gpio), bit = GPIO2BIT(gpio); + Pio *regs = digital_regs[bank]; if (ptype == 'A') regs->PIO_ABSR &= ~bit; else regs->PIO_ABSR |= bit; - if (pull_up) + if (pull_up > 0) regs->PIO_PUER = bit; else regs->PIO_PUDR = bit; |