Thomas SOETE
/
SimpleUART
Simple UART0 usage with SimpleLib
Revision 2:d367033913a2, committed 2010-11-13
- Comitter:
- Alkorin
- Date:
- Sat Nov 13 14:48:05 2010 +0000
- Parent:
- 1:6a9f5827b72e
- Commit message:
- Now working with UART0
Changed in this revision
SimpleLib.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6a9f5827b72e -r d367033913a2 SimpleLib.lib --- a/SimpleLib.lib Sat Nov 13 11:21:01 2010 +0000 +++ b/SimpleLib.lib Sat Nov 13 14:48:05 2010 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/Alkorin/code/SimpleLib/#b3aa0a49e21f +http://mbed.org/users/Alkorin/code/SimpleLib/#9e1310782abf
diff -r 6a9f5827b72e -r d367033913a2 main.cpp --- a/main.cpp Sat Nov 13 11:21:01 2010 +0000 +++ b/main.cpp Sat Nov 13 14:48:05 2010 +0000 @@ -5,8 +5,6 @@ #include "serial.h" #include "leds.h" -Serial pc(USBTX, USBRX); - void serialOut(unsigned char c) { SERIAL_PUTCHAR(c); } @@ -18,6 +16,19 @@ } } +void serialOutHex32(unsigned int i) +{ + for(int j = 0; j < 8; j++) + { + unsigned char c = (i & 0xF0000000) >> 28; + if(c < 10) + serialOut('0' + c); + else + serialOut('A' + c - 10); + i = i << 4; + } +} + SERIAL_INTERRUPT_HANDLER(void) { // Check if interrupt is pending if(!SERIAL_CHECK_INTERRUPT()) @@ -34,12 +45,11 @@ int main() { // Hardware Init - // SERIAL_INIT(); - // SERIAL_SETBAUD(9600); - pc.baud(9600); + SERIAL_INIT(); + SERIAL_SETBAUD(9600); SERIAL_ENABLE_INTERRUPT(SERIAL_INT_RX); - + serialOutString("Simple UART Sample Code\r\n"); - + while (1); } \ No newline at end of file