aboutsummaryrefslogtreecommitdiff
path: root/lib/lm4f/gpio.c
diff options
context:
space:
mode:
authorPiotr Esden-Tempski2013-01-06 18:09:21 -0800
committerPiotr Esden-Tempski2013-01-06 18:09:21 -0800
commitf83f8d55d784ea9e3e48ab074f92f7b63a9af956 (patch)
tree5b8fdecf8bd91646fbcd94ce4d8354efbbffa6b4 /lib/lm4f/gpio.c
parentc03cbc41a1c260b160bee5b4a99fed9946f26c07 (diff)
parent400891f5b01bb431e57ab25b6a0e4c7e4260bc89 (diff)
Merging pull request #74 LM4F initial support
Merge remote-tracking branch 'mrnuke/lm4f_initial'
Diffstat (limited to 'lib/lm4f/gpio.c')
-rw-r--r--lib/lm4f/gpio.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/lm4f/gpio.c b/lib/lm4f/gpio.c
new file mode 100644
index 0000000..2d50116
--- /dev/null
+++ b/lib/lm4f/gpio.c
@@ -0,0 +1,31 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libopencm3/lm4f/gpio.h>
+
+void gpio_set(u32 gpioport, u8 gpios)
+{
+ /* ipaddr[9:2] mask the bits to be set, hence the array index */
+ GPIO_DATA(gpioport)[gpios] = 0xff;
+}
+
+void gpio_clear(u32 gpioport, u8 gpios)
+{
+ GPIO_DATA(gpioport)[gpios] = 0;
+}