tetete

Dependencies:   FIFO

Revision:
14:54cbbb00bd19
Parent:
13:e372a354d969
Child:
15:278f7f125495
--- a/AsyncSerial.cpp	Wed Aug 23 01:11:52 2017 +0000
+++ b/AsyncSerial.cpp	Mon Aug 28 12:25:37 2017 +0000
@@ -21,7 +21,7 @@
 
 AsyncSerial::AsyncSerial(PinName txpin, PinName rxpin, uint32_t baudrate, uint32_t buffer_size){
 	
-	led = new DigitalOut(LED1);
+	//led = new DigitalOut(LED2);
 	
 	// RawSerial port init
 	serial = new RawSerial(txpin, rxpin, baudrate);
@@ -34,6 +34,12 @@
     //led->write(1);
     //led->write(0); // Went off
 	
+		
+	fifo_tx->clear();
+	fifo_rx->clear();
+	
+	Is_Serial_Sending = false;
+	
 	//Initialize ISR
 	serial->attach(callback(this, &AsyncSerial::ISR_TX), SerialBase::TxIrq);
 	serial->attach(callback(this, &AsyncSerial::ISR_RX), SerialBase::RxIrq);
@@ -41,17 +47,13 @@
 	// Debug
 	//led->write(0);   // Didnt go off
 	
-	fifo_tx->clear();
-	fifo_rx->clear();
-	
-	Is_Serial_Sending = false;
-	
 	return;
 }
 
 AsyncSerial::~AsyncSerial(){
 	serial->attach(NULL, serial->TxIrq);
 	serial->attach(NULL, serial->RxIrq);
+    led->write(1);
 	
 	delete serial;
 	return;