Laurent Huot
/
SPI
drtgddf
Diff: UART.cpp
- Revision:
- 1:2b2be189b4db
- Parent:
- 0:aab1f335cf6b
diff -r aab1f335cf6b -r 2b2be189b4db UART.cpp --- a/UART.cpp Mon Jan 11 19:10:09 2016 +0000 +++ b/UART.cpp Mon Jan 11 21:09:20 2016 +0000 @@ -1,12 +1,23 @@ #include "UART.h" +#include "LPC17xx.h" UART::UART() { + PCOMP = (int *)0x400FC0C4; + PCLKSEL0 = (int *)0x400FC1A8; + U0LCR = (int *)0x4000C00C; + U0DLL = (int *)0x4000C000; + U0DLM = (int *)0x4000C004; + U0FCR = (int *)0x4000C008; + PINSEL0 = (int *)0x4002C000; - //*PCLKSEL0 |= 0x000000C0; + //Donne acces aux registres DLL et DLM pour set le baud rate *U0LCR |= 0x00000080; + //On met le registre de PCLK_UART0 à 01 + *PCLKSEL0 |= 0x00000080; + //On active les pins pour TXD0 *PINSEL0 &= ~0x00000020; *PINSEL0 |= 0x00000010; @@ -18,6 +29,4 @@ *U0LCR |= 0x00000003; //1 Seul stop bit, pas de parite *U0LCR &= ~0x0000000C; - - } \ No newline at end of file