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)

Dependencies:   mbed

Committer:
maro
Date:
Fri Feb 28 10:16:28 2014 +0000
Revision:
0:e5f3c8836d1c
LPC810 switch matrix and UART example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maro 0:e5f3c8836d1c 1 #include "mbed.h"
maro 0:e5f3c8836d1c 2
maro 0:e5f3c8836d1c 3 //DigitalOut myled(LED1);
maro 0:e5f3c8836d1c 4 DigitalOut myled(P0_4); //p2
maro 0:e5f3c8836d1c 5 RawSerial uart(P0_0, P0_1); //p8, p5
maro 0:e5f3c8836d1c 6
maro 0:e5f3c8836d1c 7 //8p:U0_TX, 5p:U0_RX
maro 0:e5f3c8836d1c 8 void SwitchMatrix_Init() //generated by NXP Switch Matrix Tool
maro 0:e5f3c8836d1c 9 {
maro 0:e5f3c8836d1c 10 /* Enable SWM clock */
maro 0:e5f3c8836d1c 11 LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7);
maro 0:e5f3c8836d1c 12
maro 0:e5f3c8836d1c 13 /* Pin Assign 8 bit Configuration */
maro 0:e5f3c8836d1c 14 /* U0_TXD */
maro 0:e5f3c8836d1c 15 /* U0_RXD */
maro 0:e5f3c8836d1c 16 LPC_SWM->PINASSIGN0 = 0xffff0100UL;
maro 0:e5f3c8836d1c 17
maro 0:e5f3c8836d1c 18 /* Pin Assign 1 bit Configuration */
maro 0:e5f3c8836d1c 19 /* SWCLK */
maro 0:e5f3c8836d1c 20 /* SWDIO */
maro 0:e5f3c8836d1c 21 /* RESET */
maro 0:e5f3c8836d1c 22 LPC_SWM->PINENABLE0 = 0xffffffb3UL;
maro 0:e5f3c8836d1c 23 }
maro 0:e5f3c8836d1c 24
maro 0:e5f3c8836d1c 25 int main() {
maro 0:e5f3c8836d1c 26 SwitchMatrix_Init();
maro 0:e5f3c8836d1c 27 uart.baud(9600);
maro 0:e5f3c8836d1c 28 char c;
maro 0:e5f3c8836d1c 29 while(1) {
maro 0:e5f3c8836d1c 30 if(uart.readable())
maro 0:e5f3c8836d1c 31 {
maro 0:e5f3c8836d1c 32 c = uart.getc();
maro 0:e5f3c8836d1c 33 uart.putc(c);
maro 0:e5f3c8836d1c 34 }
maro 0:e5f3c8836d1c 35 myled = !myled;
maro 0:e5f3c8836d1c 36 }
maro 0:e5f3c8836d1c 37 }