aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorUwe Hermann2009-07-18 17:41:31 +0200
committerUwe Hermann2009-07-18 17:41:31 +0200
commit3bef8767f966eaa960a3dfc5609a3952f4b00627 (patch)
treeb209474766bba374624cc0125a5090078a918039 /lib
parent83f5c58eb996234ca98967db923133514e92ff7c (diff)
Add gpio_get() API function.
Diffstat (limited to 'lib')
-rw-r--r--lib/gpio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/gpio.c b/lib/gpio.c
index e9f90ca..2ade842 100644
--- a/lib/gpio.c
+++ b/lib/gpio.c
@@ -25,6 +25,7 @@
* GPIO_CNF_OUTPUT_PUSHPULL, GPIO12);
* gpio_set(GPIOB, GPIO4);
* gpio_clear(GPIOG, GPIO2 | GPIO9);
+ * gpio_get(GPIOC, GPIO1);
* gpio_toggle(GPIOA, GPIO7);
* reg16 = gpio_port_read(GPIOD);
* gpio_port_write(GPIOF, 0xc8fe);
@@ -66,6 +67,11 @@ void gpio_clear(u32 gpioport, u16 gpios)
GPIO_BRR(gpioport) = gpios;
}
+u16 gpio_get(u32 gpioport, u16 gpios)
+{
+ return gpio_port_read(gpioport) & gpios;
+}
+
/* TODO: Should work for multiple GPIOs? */
void gpio_toggle(u32 gpioport, u16 gpio)
{