---
 examples/lpc43xx/lpclink2/README                |  2 +
 examples/lpc43xx/lpclink2/lpclink2_conf.h       | 73 +++++++++++++++++++++++++
 examples/lpc43xx/lpclink2/lpclink2_sram.ld      | 33 +++++++++++
 examples/lpc43xx/lpclink2/miniblink/Makefile    | 24 ++++++++
 examples/lpc43xx/lpclink2/miniblink/README      |  9 +++
 examples/lpc43xx/lpclink2/miniblink/miniblink.c | 72 ++++++++++++++++++++++++
 6 files changed, 213 insertions(+)
 create mode 100644 examples/lpc43xx/lpclink2/README
 create mode 100644 examples/lpc43xx/lpclink2/lpclink2_conf.h
 create mode 100644 examples/lpc43xx/lpclink2/lpclink2_sram.ld
 create mode 100644 examples/lpc43xx/lpclink2/miniblink/Makefile
 create mode 100644 examples/lpc43xx/lpclink2/miniblink/README
 create mode 100644 examples/lpc43xx/lpclink2/miniblink/miniblink.c

diff --git a/examples/lpc43xx/lpclink2/README b/examples/lpc43xx/lpclink2/README
new file mode 100644
index 0000000..5e6f6e1
--- /dev/null
+++ b/examples/lpc43xx/lpclink2/README
@@ -0,0 +1,2 @@
+These example programs are written for the LPCLinkII development board from
+http://www.embeddedartists.com/products/lpcxpresso/lpclink2.php
diff --git a/examples/lpc43xx/lpclink2/lpclink2_conf.h 
b/examples/lpc43xx/lpclink2/lpclink2_conf.h
new file mode 100644
index 0000000..74c61b9
--- /dev/null
+++ b/examples/lpc43xx/lpclink2/lpclink2_conf.h
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2012 Benjamin Vernoux <titan...@gmail.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/>.
+ */
+
+#ifndef __LPCLINKII_CONF_H
+#define __LPCLINKII_CONF_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <libopencm3/lpc43xx/scu.h>
+
+/*
+ * LPCLinkII SCU PinMux
+ */
+
+/* GPIO Output PinMux */
+#define SCU_PINMUX_LED1     (P1_1) /* GPIO0[8] on P1_1 */
+
+/* GPIO Input PinMux */
+#define SCU_PINMUX_BOOT1    (P1_2) /* GPIO0[9] on P1_2 */
+#define SCU_PINMUX_BOOT2    (P2_8) /* GPIO5[7] on P2_8 */
+#define SCU_PINMUX_BOOT3    (P2_9) /* GPIO1[10] on P2_9 */
+
+/* SSP1 Peripheral PinMux */
+#define SCU_SSP1_MISO       (P1_3) /* P1_3 */
+#define SCU_SSP1_MOSI       (P1_4) /* P1_4 */
+#define SCU_SSP1_SCK        (P1_19) /* P1_19 */
+#define SCU_SSP1_SSEL       (P1_20) /* P1_20 */
+
+/* TODO add other Pins */
+
+/*
+ * LPCLinkII GPIO Pin
+ */
+/* GPIO Output */
+#define PIN_LED1    (BIT8) /* GPIO0[8] on P1_1 */
+#define PORT_LED1   (GPIO0) /* PORT for LED1 */
+
+/* GPIO Input */
+#define PIN_BOOT1   (BIT9)  /* GPIO0[9] on P1_2 */
+#define PIN_BOOT2   (BIT7)  /* GPIO5[7] on P2_8 */
+#define PIN_BOOT3   (BIT10) /* GPIO1[10] on P2_9 */
+
+/* Read GPIO Pin */
+#define BOOT1_STATE ( (GPIO0_PIN & PIN_BOOT1)==PIN_BOOT1 )
+#define BOOT2_STATE ( (GPIO5_PIN & PIN_BOOT2)==PIN_BOOT2 )
+#define BOOT3_STATE ( (GPIO1_PIN & PIN_BOOT3)==PIN_BOOT3 )
+
+/* TODO add other Pins */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/examples/lpc43xx/lpclink2/lpclink2_sram.ld 
b/examples/lpc43xx/lpclink2/lpclink2_sram.ld
new file mode 100644
index 0000000..c6bba3e
--- /dev/null
+++ b/examples/lpc43xx/lpclink2/lpclink2_sram.ld
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2010 Uwe Hermann <u...@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/>.
+ */
+
+/* Linker script for LPCLinkII (LPC4320, 282K SRAM). */
+
+/* Define memory regions. */
+MEMORY
+{
+  /* rom is really the shadow region that points to SPI flash or elsewhere */
+  rom (rx)  : ORIGIN = 0x10000000, LENGTH =  64k
+  ram (rwx) : ORIGIN = 0x10010000, LENGTH =  64K
+  ram_local2 (rwx) : ORIGIN = 0x10080000, LENGTH =  64K
+  /* there are some additional RAM regions */
+}
+
+/* Include the common ld script. */
+INCLUDE libopencm3_lpc43xx.ld
diff --git a/examples/lpc43xx/lpclink2/miniblink/Makefile 
b/examples/lpc43xx/lpclink2/miniblink/Makefile
new file mode 100644
index 0000000..feddd37
--- /dev/null
+++ b/examples/lpc43xx/lpclink2/miniblink/Makefile
@@ -0,0 +1,24 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2010 Uwe Hermann <u...@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 = ../lpclink2_sram.ld
+
+include ../../Makefile.include
diff --git a/examples/lpc43xx/lpclink2/miniblink/README 
b/examples/lpc43xx/lpclink2/miniblink/README
new file mode 100644
index 0000000..980bd92
--- /dev/null
+++ b/examples/lpc43xx/lpclink2/miniblink/README
@@ -0,0 +1,9 @@
+------------------------------------------------------------------------------
+README
+------------------------------------------------------------------------------
+
+This is the smallest-possible example program using libopencm3.
+
+It's intended for the Embedded artists LPC-Link2 board.
+http://www.embeddedartists.com/products/lpcxpresso/lpclink2.php
+It should blink LED1 (P1-1) on the board.
diff --git a/examples/lpc43xx/lpclink2/miniblink/miniblink.c 
b/examples/lpc43xx/lpclink2/miniblink/miniblink.c
new file mode 100644
index 0000000..70aa943
--- /dev/null
+++ b/examples/lpc43xx/lpclink2/miniblink/miniblink.c
@@ -0,0 +1,72 @@
+/*
+* This file is part of the libopencm3 project.
+*
+* Copyright (C) 2010 Uwe Hermann <u...@hermann-uwe.de>
+* Copyright (C) 2012 Michael Ossmann <m...@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>
+#include <libopencm3/lpc43xx/scu.h>
+
+#include "../lpclink2_conf.h"
+
+static void gpio_setup(void)
+{
+       /* Configure SCU Pin Mux as GPIO */
+       scu_pinmux(SCU_PINMUX_LED1, SCU_GPIO_FAST);
+
+       scu_pinmux(SCU_PINMUX_BOOT1, SCU_GPIO_FAST);
+       scu_pinmux(SCU_PINMUX_BOOT2, SCU_GPIO_FAST);
+       scu_pinmux(SCU_PINMUX_BOOT3, SCU_GPIO_FAST);
+
+       /* Configure all GPIO as Input (safe state) */
+       GPIO0_DIR = 0;
+       GPIO1_DIR = 0;
+       GPIO2_DIR = 0;
+       GPIO3_DIR = 0;
+       GPIO4_DIR = 0;
+       GPIO5_DIR = 0;
+       GPIO6_DIR = 0;
+       GPIO7_DIR = 0;
+
+       /* Configure GPIO as Output */
+       GPIO0_DIR |= (PIN_LED1); /* Configure GPIO1[1] (P1_1) as output. */
+}
+
+uint32_t boot1, boot2, boot3;
+
+int main(void)
+{
+       int i;
+       gpio_setup();
+
+       /* Blink LED1 on the board and Read BOOT1/2/3 pins. */
+       while (1)
+       {
+               boot1 = BOOT1_STATE;
+               boot2 = BOOT2_STATE;
+               boot3 = BOOT3_STATE;
+
+               gpio_set(PORT_LED1, (PIN_LED1)); /* LEDs on */
+               for (i = 0; i < 2000000; i++)   /* Wait a bit. */
+                       __asm__("nop");
+               gpio_clear(PORT_LED1, (PIN_LED1)); /* LED off */
+               for (i = 0; i < 2000000; i++)   /* Wait a bit. */
+                       __asm__("nop");
+       }
+
+       return 0;
+}
-- 
1.8.4.5


------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
libopencm3-devel mailing list
libopencm3-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel

Reply via email to