aboutsummaryrefslogtreecommitdiff
path: root/lib/lm3s/gpio.c
diff options
context:
space:
mode:
authorGareth McMullin2011-02-04 22:47:51 +1300
committerGareth McMullin2011-02-04 22:47:51 +1300
commit769a932f3ec147bddbf488a88214dfb12a4eed78 (patch)
tree52cb7feea948e40f2ee2ab4da3bbd26d730b3390 /lib/lm3s/gpio.c
parent729a48c6557ec4ef4b0ec87f2de47010f8066ee8 (diff)
Added initial support for the LuminaryMicro LM3S family.
Diffstat (limited to 'lib/lm3s/gpio.c')
-rw-r--r--lib/lm3s/gpio.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/lm3s/gpio.c b/lib/lm3s/gpio.c
new file mode 100644
index 0000000..34df295
--- /dev/null
+++ b/lib/lm3s/gpio.c
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libopencm3/lm3s/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;
+}
+