LLAP Library for Ciseco wireless products.
Dependents: Ciseco_LLAP_Test Ciseco_SRF_Shield
Library for Ciseco wireless modules http://shop.ciseco.co.uk/rf-module-range/
Tested with Nucleo F401RE and http://shop.ciseco.co.uk/srf-shield-wireless-transciever-for-all-arduino-type-boards/
Diff: LLAPSerial.cpp
- Revision:
- 3:08f5e8989688
- Parent:
- 2:73b87761ce69
- Child:
- 6:0745fb4dbd8c
--- a/LLAPSerial.cpp Wed Apr 16 08:03:48 2014 +0000 +++ b/LLAPSerial.cpp Wed Apr 16 08:06:18 2014 +0000 @@ -47,13 +47,14 @@ // Constructors to pass in Tx/Rx pins and optional ID, default is -- as defined in LLAPSerial.h -LLAPSerial::LLAPSerial(PinName txPin, PinName rxPin, char *dID) : srf(txPin, rxPin) +LLAPSerial::LLAPSerial(PinName txPin, PinName rxPin, bool checkDevIDin, char *dID) : srf(txPin, rxPin) { srf.baud(115200); bMsgReceived = false; setDeviceId(dID); cMessage[12]=0; // ensure terminated inPtr = cMessage; + checkDevID = checkDevIDin; // Attach the receive interrupt handler srf.attach( this,&LLAPSerial::SerialEvent ); } @@ -61,9 +62,10 @@ void LLAPSerial::processMessage() { - //if (LLAP.cMessage[0] != 'a') return; //not needed as already checked -// if (cMessage[1] != deviceId[0]) return; -// if (cMessage[2] != deviceId[1]) return; + if( checkDevID ) { + if (cMessage[1] != deviceId[0]) return; + if (cMessage[2] != deviceId[1]) return; + } // now we have LLAP.cMessage[3] to LLAP.cMessage[11] as the actual message if (0 == strncmp(&cMessage[3],"HELLO----",9)) { srf.printf("%s",cMessage); // echo the message