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/
Revision 3:08f5e8989688, committed 2014-04-16
- Comitter:
- SomeRandomBloke
- Date:
- Wed Apr 16 08:06:18 2014 +0000
- Parent:
- 2:73b87761ce69
- Child:
- 4:34499a4a4ec7
- Commit message:
- Updated constructor
Changed in this revision
LLAPSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
LLAPSerial.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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
--- a/LLAPSerial.h Wed Apr 16 08:03:48 2014 +0000 +++ b/LLAPSerial.h Wed Apr 16 08:06:18 2014 +0000 @@ -51,7 +51,7 @@ * @param checkNodeID Check the incoming Device ID and ignore if it doesnt match * @param dID ID for device, used in sending messages and if checkNodeID is true then only messages for this ID are accepted */ - LLAPSerial(PinName txPin, PinName rxPin, bool checkDevID = false, char *dID = "--" ); + LLAPSerial(PinName txPin, PinName rxPin, bool checkDevIDin = false, char *dID = "--" ); /** Send a message * @param sToSend Character pointer to message to send, will be padded with - to full length or truncated if too long