diff options
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/gpio.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libmaple/gpio.h b/libmaple/gpio.h index ac8af5b..a44047e 100644 --- a/libmaple/gpio.h +++ b/libmaple/gpio.h @@ -93,6 +93,10 @@ static inline void gpio_write_bit(GPIO_Port *port, uint8 gpio_pin, uint8 val) { } } +static inline uint32 gpio_read_bit(GPIO_Port *port, uint8 gpio_pin) { + return (port->IDR & BIT(gpio_pin) ? 1 : 0); +} + #ifdef __cplusplus } // extern "C" #endif |