summaryrefslogtreecommitdiff
path: root/include/arch/stm32f446re-nucleo/driver
diff options
context:
space:
mode:
Diffstat (limited to 'include/arch/stm32f446re-nucleo/driver')
-rw-r--r--include/arch/stm32f446re-nucleo/driver/gpio.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/arch/stm32f446re-nucleo/driver/gpio.h b/include/arch/stm32f446re-nucleo/driver/gpio.h
index dbb0465..b98078d 100644
--- a/include/arch/stm32f446re-nucleo/driver/gpio.h
+++ b/include/arch/stm32f446re-nucleo/driver/gpio.h
@@ -62,9 +62,16 @@ class GPIO {
}
/*
inline void output(unsigned char const pin, unsigned char const value) {
- }
- inline unsigned char read(unsigned char const pin) {
}*/
+ inline unsigned int read(unsigned char const pin) {
+ if (pin < pb_0) {
+ return gpio_get(GPIOA, 1 << pin);
+ } else if (pin < pc_0) {
+ return gpio_get(GPIOB, 1 << (pin-pb_0));
+ } else if (pin < PIN_INVALID) {
+ return gpio_get(GPIOC, 1 << (pin-pc_0));
+ }
+ }
inline void write(unsigned char const pin, unsigned char value) {
if (pin < pb_0) {
if (value) {