summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-09-10 13:32:09 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-09-10 13:32:09 +0200
commitda25f533e1c25766bee540bf7de00353930bf29d (patch)
tree8eadd2b2491e3eb9e80caf2ca8eb6db3baa1e5e0 /include
parent7f8c04c036ff5d7768ec4b53e0409d666b20d59b (diff)
stm32f446re-nucleo gpio: Fix offsets
Diffstat (limited to 'include')
-rw-r--r--include/arch/stm32f446re-nucleo/driver/gpio.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/arch/stm32f446re-nucleo/driver/gpio.h b/include/arch/stm32f446re-nucleo/driver/gpio.h
index 787b33d..dbb0465 100644
--- a/include/arch/stm32f446re-nucleo/driver/gpio.h
+++ b/include/arch/stm32f446re-nucleo/driver/gpio.h
@@ -46,7 +46,7 @@ class GPIO {
} else if (pin < pc_0) {
gpio_mode_setup(GPIOB, GPIO_MODE_INPUT, GPIO_PUPD_NONE, 1 << (pin - pb_0));
} else if (pin < PIN_INVALID) {
- gpio_mode_setup(GPIOC, GPIO_MODE_INPUT, GPIO_PUPD_NONE, 1 << (pin - PIN_INVALID));
+ gpio_mode_setup(GPIOC, GPIO_MODE_INPUT, GPIO_PUPD_NONE, 1 << (pin - pc_0));
}
}
inline void input(unsigned char const pin, unsigned char const pull) {
@@ -57,7 +57,7 @@ class GPIO {
} else if (pin < pc_0) {
gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, 1 << (pin - pb_0));
} else if (pin < PIN_INVALID) {
- gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, 1 << (pin - PIN_INVALID));
+ gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, 1 << (pin - pc_0));
}
}
/*
@@ -74,15 +74,15 @@ class GPIO {
}
} else if (pin < pc_0) {
if (value) {
- gpio_port_write(GPIOB, gpio_port_read(GPIOB) | (1 << (pin-pc_0)));
+ gpio_port_write(GPIOB, gpio_port_read(GPIOB) | (1 << (pin-pb_0)));
} else {
- gpio_port_write(GPIOB, gpio_port_read(GPIOB) & ~(1 << (pin-pc_0)));
+ gpio_port_write(GPIOB, gpio_port_read(GPIOB) & ~(1 << (pin-pb_0)));
}
} else if (pin < PIN_INVALID) {
if (value) {
- gpio_port_write(GPIOC, gpio_port_read(GPIOC) | (1 << (pin-PIN_INVALID)));
+ gpio_port_write(GPIOC, gpio_port_read(GPIOC) | (1 << (pin-pc_0)));
} else {
- gpio_port_write(GPIOC, gpio_port_read(GPIOC) & ~(1 << (pin-PIN_INVALID)));
+ gpio_port_write(GPIOC, gpio_port_read(GPIOC) & ~(1 << (pin-pc_0)));
}
}
}