aboutsummaryrefslogtreecommitdiffstats
path: root/src/sam4e8e/gpio.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-12-25 11:19:30 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-07 19:30:17 -0500
commit7707d5a74e5dc13c07fa637447e00be30cca582b (patch)
tree5d047fc7a2e6df01ad42c28c6a5b96183d41fef5 /src/sam4e8e/gpio.c
parentf0715de0049b238b4bbcb0389fe5848fd271118e (diff)
downloadkutter-7707d5a74e5dc13c07fa637447e00be30cca582b.tar.gz
kutter-7707d5a74e5dc13c07fa637447e00be30cca582b.tar.xz
kutter-7707d5a74e5dc13c07fa637447e00be30cca582b.zip
sam4e8e: Rename gpio_set_peripheral() to gpio_peripheral()
Use the same definition for gpio_peripheral() that the sam3x8e code uses. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/sam4e8e/gpio.c')
-rw-r--r--src/sam4e8e/gpio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sam4e8e/gpio.c b/src/sam4e8e/gpio.c
index 48695fc9..11516e44 100644
--- a/src/sam4e8e/gpio.c
+++ b/src/sam4e8e/gpio.c
@@ -8,7 +8,7 @@
#include "board/irq.h" // irq_save
#include "command.h" // shutdown
#include "gpio.h" // gpio_out_setup
-#include "internal.h" // gpio_set_peripheral
+#include "internal.h" // gpio_peripheral
#include "sam4e.h" // Pio
#include "sched.h" // sched_shutdown
@@ -22,9 +22,10 @@ static Pio * const digital_regs[] = {
****************************************************************/
void
-gpio_set_peripheral(char bank, const uint32_t bit, char ptype, uint32_t pull_up) {
-
- Pio *regs = digital_regs[bank - 'A'];
+gpio_peripheral(uint32_t gpio, char ptype, int32_t pull_up)
+{
+ uint32_t bank = GPIO2PORT(gpio), bit = GPIO2BIT(gpio);
+ Pio *regs = digital_regs[bank];
regs ->PIO_IDR = bit;
// Enable peripheral for pin
@@ -61,7 +62,7 @@ gpio_set_peripheral(char bank, const uint32_t bit, char ptype, uint32_t pull_up)
regs->PIO_PDR = bit;
// Set pullup
- if (pull_up) {
+ if (pull_up > 0) {
regs->PIO_PUER = bit;
} else {
regs->PIO_PUDR = bit;