A libery to connect to telegesis zigbee module. Bassed on implemtation of XBEE
Fork of xbee_lib by
Diff: telegesis.cpp
- Revision:
- 25:31120552e53c
- Parent:
- 24:5ed5311266b0
- Child:
- 26:2a85af491d92
diff -r 5ed5311266b0 -r 31120552e53c telegesis.cpp --- a/telegesis.cpp Tue Nov 12 09:19:52 2013 +0000 +++ b/telegesis.cpp Sat Nov 16 13:14:26 2013 +0000 @@ -23,7 +23,7 @@ t.reset(); t.start(); b=0; - while((b!=CR) & (t.read_ms() < 1000)) + while((b!=CR) && (t.read_ms() < 1000)) if (_zbee.readable()) SeePacket(); t.stop(); //if (_zbee.readable()) readPacket(); @@ -34,7 +34,7 @@ Timer t; t.reset(); t.start(); - while ((strstr(_responseFrameString,p)==0) & (t.read_ms() < 5000)) readPacket(); + while ((strstr(_responseFrameString,p)==0) && (t.read_ms() < 5000)) readPacket(); t.stop(); return (strstr(_responseFrameString,p)>0); } @@ -46,7 +46,7 @@ t.reset(); t.start(); readPacket(); - while ((strstr(_responseFrameString,"JPAN")==0) & (t.read_ms() < 5000)) readPacket(); + while ((strstr(_responseFrameString,"JPAN")==0) && (t.read_ms() < 5000)) readPacket(); t.stop(); return (strstr(_responseFrameString,"JPAN")>0); } @@ -58,7 +58,7 @@ t.reset(); t.start(); readPacket(); - while ((PanOnline>0) & (t.read_ms() < 3000)) readPacket(); + while ((PanOnline>0) && (t.read_ms() < 3000)) readPacket(); t.stop(); return PanOnline; } @@ -70,7 +70,7 @@ t.reset(); t.start(); readPacket(); - while ((strstr(_responseFrameString,"OK")==0) & (t.read_ms() < 500)) readPacket(); + while ((strstr(_responseFrameString,"OK")==0) && (t.read_ms() < 500)) readPacket(); t.stop(); return (strstr(_responseFrameString,"OK")>0); } @@ -261,7 +261,7 @@ Timer t; t.reset(); t.start(); - while ((GotFrame==0) & (t.read_ms() < 500)) {} + while ((GotFrame==0) && (t.read_ms() < 500)) {} t.stop(); GotFrame=0; } @@ -273,7 +273,7 @@ char *p; static uint8_t _pos; b = _zbee.getc(); - if ((b!=CR) & (b!=LF)) { + if ((b!=CR) && (b!=LF)) { _responseFrameString[_pos]=b; _pos=(_pos+1) % MAX_FRAME_DATA_SIZE; } @@ -314,7 +314,7 @@ strncpy(NetNodeID,p,16); } - if ((strstr(_responseFrameString,"OK")>0) & (strstr(_responseFrameString,"TOKDUMP")==0) ) { + if ((strstr(_responseFrameString,"OK")>0) && (strstr(_responseFrameString,"TOKDUMP")==0) ) { //if (ScriptState) ConnectScript(); //Ok=1; Cmd=0; LineNo=0; } @@ -361,7 +361,7 @@ t.reset(); t.start(); b=0; - while((b!=CR) & (t.read_ms() < 1000)) + while((b!=CR) && (t.read_ms() < 1000)) if (_zbee.readable()) SeePacket(); t.stop(); }