aboutsummaryrefslogtreecommitdiff
path: root/examples/lpc43xx/hackrf-jellybean/miniblink
diff options
context:
space:
mode:
authorMichael Ossmann2012-05-22 14:47:27 -0600
committerMichael Ossmann2012-05-22 14:47:27 -0600
commit9645172453488a0d490dd0a930a2b2e122e7ea82 (patch)
tree6e2556fc6975fe7841be7363331e82fcbf981ecc /examples/lpc43xx/hackrf-jellybean/miniblink
parent4c37af55f455e3c404aff8acf45b3544156076a1 (diff)
lpc43xx example, copied from lpc17xx and modified
Diffstat (limited to 'examples/lpc43xx/hackrf-jellybean/miniblink')
-rw-r--r--examples/lpc43xx/hackrf-jellybean/miniblink/Makefile24
-rw-r--r--examples/lpc43xx/hackrf-jellybean/miniblink/README11
-rw-r--r--examples/lpc43xx/hackrf-jellybean/miniblink/miniblink.c46
3 files changed, 81 insertions, 0 deletions
diff --git a/examples/lpc43xx/hackrf-jellybean/miniblink/Makefile b/examples/lpc43xx/hackrf-jellybean/miniblink/Makefile
new file mode 100644
index 0000000..32da7ff
--- /dev/null
+++ b/examples/lpc43xx/hackrf-jellybean/miniblink/Makefile
@@ -0,0 +1,24 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## 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/>.
+##
+
+BINARY = miniblink
+
+LDSCRIPT = ../jellybean-lpc4330.ld
+
+include ../../Makefile.include
diff --git a/examples/lpc43xx/hackrf-jellybean/miniblink/README b/examples/lpc43xx/hackrf-jellybean/miniblink/README
new file mode 100644
index 0000000..556ed92
--- /dev/null
+++ b/examples/lpc43xx/hackrf-jellybean/miniblink/README
@@ -0,0 +1,11 @@
+------------------------------------------------------------------------------
+README
+------------------------------------------------------------------------------
+
+This is the smallest-possible example program using libopencm3.
+
+It's intended for the Jellybean development board from the HackRF project:
+
+https://github.com/mossmann/hackrf
+
+It should blink LED1 on the board.
diff --git a/examples/lpc43xx/hackrf-jellybean/miniblink/miniblink.c b/examples/lpc43xx/hackrf-jellybean/miniblink/miniblink.c
new file mode 100644
index 0000000..6d8a9bc
--- /dev/null
+++ b/examples/lpc43xx/hackrf-jellybean/miniblink/miniblink.c
@@ -0,0 +1,46 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
+ * Copyright (C) 2012 Michael Ossmann <mike@ossmann.com>
+ *
+ * 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/lpc43xx/gpio.h>
+
+void gpio_setup(void)
+{
+ GPIO2_DIR |= (1 << 1); /* Configure GPIO2[1] (P4_1) as output. */
+}
+
+int main(void)
+{
+ int i;
+
+ gpio_setup();
+
+ /* Blink LED1 on the board. */
+ while (1) {
+
+ gpio_set(GPIO2, GPIOPIN1); /* LED on */
+ for (i = 0; i < 800000; i++) /* Wait a bit. */
+ __asm__("nop");
+ gpio_clear(GPIO2, GPIOPIN1); /* LED off */
+ for (i = 0; i < 800000; i++) /* Wait a bit. */
+ __asm__("nop");
+ }
+
+ return 0;
+}