aboutsummaryrefslogtreecommitdiff
path: root/lib/lm4f/gpio.c
diff options
context:
space:
mode:
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;
+}