diff options
author | Perry Hung <iperry@alum.mit.edu> | 2010-04-19 22:25:49 -0400 |
---|---|---|
committer | Perry Hung <iperry@alum.mit.edu> | 2010-04-19 23:31:32 -0400 |
commit | a7b3786810ee93c81b65a431c04fd2f5d75354d2 (patch) | |
tree | 60228366992d21f28a0a28d4ca3b787c8a7bc8cd /libmaple | |
parent | 9e6010339c47f62446c38a1f7deded8bc2647703 (diff) | |
download | librambutan-a7b3786810ee93c81b65a431c04fd2f5d75354d2.tar.gz librambutan-a7b3786810ee93c81b65a431c04fd2f5d75354d2.zip |
Added libmaple gpio_read_bit
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 |