Skip to content
Snippets Groups Projects
Commit 112bb491 authored by Daniel Friesel's avatar Daniel Friesel
Browse files

stm32f446re: implement gpio.read

parent da25f533
No related branches found
No related tags found
No related merge requests found
...@@ -62,9 +62,16 @@ class GPIO { ...@@ -62,9 +62,16 @@ class GPIO {
} }
/* /*
inline void output(unsigned char const pin, unsigned char const value) { 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) { inline void write(unsigned char const pin, unsigned char value) {
if (pin < pb_0) { if (pin < pb_0) {
if (value) { if (value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment