1)SwitchMatrix SwitchMatrix_Init() was generated by NXP Switch Matrix Tool 2)RawSerial class To make the code size smaller RawSerial class is in the latest mbed library(lpc812)
Revision 0:e5f3c8836d1c, committed 2014-02-28
- Comitter:
- maro
- Date:
- Fri Feb 28 10:16:28 2014 +0000
- Commit message:
- LPC810 switch matrix and UART example
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lpc810.s Fri Feb 28 10:16:28 2014 +0000 @@ -0,0 +1,22 @@ +;patch for lpc810 +; + PRESERVE8 + THUMB + + AREA |.text|, CODE, READONLY + +Reset_Handler PROC + EXPORT Reset_Handler + IMPORT SystemInit + IMPORT __main + LDR R0, =0x10000400 + MOV SP,R0 + LDR R0, =SystemInit + BLX R0 + LDR R0, =__main+4 + BX R0 + ENDP + + ALIGN + + END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Feb 28 10:16:28 2014 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+
+//DigitalOut myled(LED1);
+DigitalOut myled(P0_4); //p2
+RawSerial uart(P0_0, P0_1); //p8, p5
+
+//8p:U0_TX, 5p:U0_RX
+void SwitchMatrix_Init() //generated by NXP Switch Matrix Tool
+{
+ /* Enable SWM clock */
+ LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7);
+
+ /* Pin Assign 8 bit Configuration */
+ /* U0_TXD */
+ /* U0_RXD */
+ LPC_SWM->PINASSIGN0 = 0xffff0100UL;
+
+ /* Pin Assign 1 bit Configuration */
+ /* SWCLK */
+ /* SWDIO */
+ /* RESET */
+ LPC_SWM->PINENABLE0 = 0xffffffb3UL;
+}
+
+int main() {
+ SwitchMatrix_Init();
+ uart.baud(9600);
+ char c;
+ while(1) {
+ if(uart.readable())
+ {
+ c = uart.getc();
+ uart.putc(c);
+ }
+ myled = !myled;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Feb 28 10:16:28 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1 \ No newline at end of file