Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MODSERIAL by
Diff: INIT.cpp
- Revision:
- 27:9c93ce7cb9d8
- Parent:
- 25:ae0408ebdd68
- Child:
- 28:76793a84f9e5
diff -r 91e4dba7ebe2 -r 9c93ce7cb9d8 INIT.cpp
--- a/INIT.cpp	Mon Jun 10 19:06:21 2013 +0000
+++ b/INIT.cpp	Thu Jul 11 13:34:53 2013 +0000
@@ -23,29 +23,23 @@
 #include "MODSERIAL.h"
 #include "MACROS.h"
 
+    #define MODSERIAL_FCR  0x08
+    #define _FCR    *((char *)_base+MODSERIAL_FCR)
+    
+    #define MODSERIAL_FIFO_ENABLE   1
+#define MODSERIAL_FIFO_RX_RESET 2
+#define MODSERIAL_FIFO_TX_RESET 4
+
 
 namespace AjK {
 
 void
 MODSERIAL::init( int txSize, int rxSize, PinName rx )
 {
-    disableIrq();
+    NVIC_DisableIRQ(_IRQ);
+    setBase();
     
     callbackInfo.setSerial(this);
-
-#ifdef __LPC11UXX_H__
-
-    _base = LPC_USART;
-    
-#else    
-    switch( _serial.index ) {
-        case 0: _base = LPC_UART0; break;
-        case 1: _base = LPC_UART1; break;
-        case 2: _base = LPC_UART2; break;
-        case 3: _base = LPC_UART3; break;
-        default: _base = NULL;      break;
-    }
-#endif
     
     dmaSendChannel  = -1;
     moddma_p        = (void *)NULL;
@@ -71,11 +65,15 @@
         error("MODSERIAL must have a defined UART to function.");
     }
     
-    _FCR = MODSERIAL_FIFO_ENABLE | MODSERIAL_FIFO_RX_RESET | MODSERIAL_FIFO_TX_RESET;
+
+    ENABLE_FIFO;
+
+    //_FCR = MODSERIAL_FIFO_ENABLE | MODSERIAL_FIFO_RX_RESET | MODSERIAL_FIFO_TX_RESET;
     
     auto_detect_char = 0;
     
-    enableIrq();
+    NVIC_EnableIRQ(_IRQ);
 }
 
 }; // namespace AjK ends
+
    