Bluetooth module HC-05 Lib. suppotrs printf(); support IrqAttach, with using RTOS. include feature as background rxIrq attach. the lib store rx buf of serial, therefore can have over 16 bytes string. if you want to get string, you call read() or getLine(). read() is ALL string, getLine() is under CR('\r').

Dependencies:   RingBuffer

Dependents:   semaforinoprova

Revision:
2:931bef8c7fac
Parent:
1:75bb445594e2
Child:
3:df094ed45a88
--- a/HC05.cpp	Thu Oct 01 04:40:15 2015 +0000
+++ b/HC05.cpp	Thu Oct 01 07:14:55 2015 +0000
@@ -5,7 +5,6 @@
     : hc05(TX, RX)
 {
 }
-//HC05::HC05(Serial &_serial)    : hc05(_serial){}
 void HC05::init(int baudrate, int bit, int parity, int stop, bool CRLN)
 {
     hc05.baud(baudrate);
@@ -24,6 +23,12 @@
     return;
 }
 
+void HC05::setAttachRx(void (*fptr)(void))
+{
+    hc05.attach(fptr, Serial::RxIrq);
+    return;
+}
+
 bool HC05::readable()
 {
     return hc05.readable();
@@ -56,10 +61,10 @@
 // for "Stream"
 int HC05::_getc()
 {
-    return -1;
+    return hc05.getc();
 }
 
-string HC05::read()
+string HC05::getLine()
 {
     static string rxStr;
 
@@ -75,14 +80,4 @@
     } // end for
 }
 
-
-/*
-void HC05::reset()
-{
-    resetPin= 0;
-    wait(0.3);
-    resetPin= 1;
-    return;
-}
-*/
-
+// EOF
\ No newline at end of file