Laurent Huot
/
SPI
drtgddf
UART.cpp@0:aab1f335cf6b, 2016-01-11 (annotated)
- Committer:
- larryspaghetti
- Date:
- Mon Jan 11 19:10:09 2016 +0000
- Revision:
- 0:aab1f335cf6b
- Child:
- 1:2b2be189b4db
allo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
larryspaghetti | 0:aab1f335cf6b | 1 | #include "UART.h" |
larryspaghetti | 0:aab1f335cf6b | 2 | |
larryspaghetti | 0:aab1f335cf6b | 3 | UART::UART() |
larryspaghetti | 0:aab1f335cf6b | 4 | { |
larryspaghetti | 0:aab1f335cf6b | 5 | |
larryspaghetti | 0:aab1f335cf6b | 6 | //*PCLKSEL0 |= 0x000000C0; |
larryspaghetti | 0:aab1f335cf6b | 7 | //Donne acces aux registres DLL et DLM pour set le baud rate |
larryspaghetti | 0:aab1f335cf6b | 8 | *U0LCR |= 0x00000080; |
larryspaghetti | 0:aab1f335cf6b | 9 | |
larryspaghetti | 0:aab1f335cf6b | 10 | //On active les pins pour TXD0 |
larryspaghetti | 0:aab1f335cf6b | 11 | *PINSEL0 &= ~0x00000020; |
larryspaghetti | 0:aab1f335cf6b | 12 | *PINSEL0 |= 0x00000010; |
larryspaghetti | 0:aab1f335cf6b | 13 | |
larryspaghetti | 0:aab1f335cf6b | 14 | //On active le FIFO |
larryspaghetti | 0:aab1f335cf6b | 15 | *U0FCR |= 0x00000001; |
larryspaghetti | 0:aab1f335cf6b | 16 | |
larryspaghetti | 0:aab1f335cf6b | 17 | //8 bits de data |
larryspaghetti | 0:aab1f335cf6b | 18 | *U0LCR |= 0x00000003; |
larryspaghetti | 0:aab1f335cf6b | 19 | //1 Seul stop bit, pas de parite |
larryspaghetti | 0:aab1f335cf6b | 20 | *U0LCR &= ~0x0000000C; |
larryspaghetti | 0:aab1f335cf6b | 21 | |
larryspaghetti | 0:aab1f335cf6b | 22 | |
larryspaghetti | 0:aab1f335cf6b | 23 | } |