tetete

Dependencies:   FIFO

Files at this revision

API Documentation at this revision

Comitter:
babylonica
Date:
Tue Aug 22 15:08:21 2017 +0000
Parent:
10:1baa8e833ac6
Child:
13:e372a354d969
Commit message:
Fixed warnings.

Changed in this revision

AsyncSerial.cpp Show annotated file Show diff for this revision Revisions of this file
AsyncSerial.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/AsyncSerial.cpp	Tue Aug 22 07:30:07 2017 +0000
+++ b/AsyncSerial.cpp	Tue Aug 22 15:08:21 2017 +0000
@@ -19,6 +19,9 @@
 #include "AsyncSerial.hpp"
 
 AsyncSerial::AsyncSerial(PinName txpin, PinName rxpin, uint32_t baudrate, uint32_t buffer_size){
+	
+	led = new DigitalOut(LED1);
+	
 	// RawSerial port init
 	serial = new RawSerial(txpin, rxpin, baudrate);
 	
@@ -26,15 +29,20 @@
 	fifo_tx = new FIFO<uint8_t>(buffer_size);
 	fifo_rx = new FIFO<uint8_t>(buffer_size);
 	
+    led->write(1);
+    
 	//Initialize ISR
-	serial->attach(this, &AsyncSerial::ISR_TX, serial->TxIrq);
-	serial->attach(this, &AsyncSerial::ISR_RX, serial->RxIrq);
-
+	///serial->attach(this, &AsyncSerial::ISR_TX, serial->TxIrq);
+	///serial->attach(this, &AsyncSerial::ISR_RX, serial->RxIrq);
+	serial->attach(callback(this, &AsyncSerial::ISR_TX), serial->TxIrq);
+	serial->attach(callback(this, &AsyncSerial::ISR_RX), serial->RxIrq);
+	
+	led->write(0);
 	fifo_tx->clear();
 	fifo_rx->clear();
 	
 	Is_Serial_Sending = false;
-
+	
 	return;
 }
 
@@ -177,8 +185,8 @@
 
 	serial->format(bits, parity, stop_bits);
 
-	serial->attach(this, &AsyncSerial::ISR_TX, serial->TxIrq);
-	serial->attach(this, &AsyncSerial::ISR_RX, serial->RxIrq);
+	serial->attach(callback(this, &AsyncSerial::ISR_TX), serial->TxIrq);
+	serial->attach(callback(this, &AsyncSerial::ISR_RX), serial->RxIrq);
 }
 
 void AsyncSerial::baud(int baudrate){
@@ -187,7 +195,7 @@
 
 	serial->baud(baudrate);
 
-	serial->attach(this, &AsyncSerial::ISR_TX, serial->TxIrq);
-	serial->attach(this, &AsyncSerial::ISR_RX, serial->RxIrq);	
+	serial->attach(callback(this, &AsyncSerial::ISR_TX), serial->TxIrq);
+	serial->attach(callback(this, &AsyncSerial::ISR_RX), serial->RxIrq);	
 }
 
--- a/AsyncSerial.hpp	Tue Aug 22 07:30:07 2017 +0000
+++ b/AsyncSerial.hpp	Tue Aug 22 15:08:21 2017 +0000
@@ -34,6 +34,11 @@
 */
 class AsyncSerial{
 private:
+	
+    DigitalOut *led;
+    
+	
+	
 	// Serial port
 	RawSerial *serial;