Simple mbed library with macros

Dependents:   SimpleTimer SimpleUART SimpleTimer Stoppuhr1

Revision:
6:9e1310782abf
Parent:
5:b3aa0a49e21f
Child:
7:8443cecf62d1
--- a/serial.h	Sat Nov 13 11:20:42 2010 +0000
+++ b/serial.h	Sat Nov 13 14:47:51 2010 +0000
@@ -46,7 +46,8 @@
 // Enable interrupt for RX or TX (SERIAL_INT_RX and SERIAL_INT_TX)
 #define SERIAL_ENABLE_INTERRUPT(value)  UART_BASE->IER = value; \
                                         ENABLE_INTERRUPT(TOKENPASTE2(UART_NUMBER,_IRQn));
-                                        
+
+// UART0 is enabled by default ?
 #define SERIAL_INIT()                   LPC_SC->PCONP |=  (1UL << 3);       \
                                         UART_BASE->FCR = 0x07;              \
                                         UART_BASE->LCR = 0x03;              \
@@ -55,7 +56,7 @@
                                         LPC_PINCON->PINSEL0 &= ~(1UL << 4); \
                                         LPC_PINCON->PINSEL0 |=  (1UL << 4); \
                                         LPC_PINCON->PINSEL0 &= ~(1UL << 6); \
-                                        LPC_PINCON->PINSEL0 |=  (1UL << 6); \
+                                        LPC_PINCON->PINSEL0 |=  (1UL << 6);
 
 // See 14.4.5 p303
 inline int SERIAL_CHECK_INTERRUPT(void) {
@@ -77,10 +78,10 @@
     
     uint16_t divisorValue = ((SystemCoreClock / 16 / baud) * divisors[UART_PCLK]);
     
-    SET_BIT_VALUE(UART_BASE->LCR, DLA_BIT, 1);
+    UART_BASE->LCR |= (1 << DLA_BIT);
     UART_BASE->DLM = (uint8_t) (divisorValue >> 8);
     UART_BASE->DLL = (uint8_t)  divisorValue;
-    SET_BIT_VALUE(UART_BASE->LCR, DLA_BIT, 0);
+    UART_BASE->LCR &= ~(1 << DLA_BIT);
 }
 
 #endif
\ No newline at end of file