summaryrefslogtreecommitdiff
path: root/include/arch/stm32f446re-nucleo/driver/gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/arch/stm32f446re-nucleo/driver/gpio.h')
-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)));
}
}
}