similar robotis communication v1.0 in this lib use for protocol to control and diagnotic robot
Fork of Communication_Robot by
Diff: communication.cpp
- Revision:
- 1:1f6864549b92
- Parent:
- 0:0c88691e3904
- Child:
- 2:56c1de1612dd
--- a/communication.cpp Sun Mar 01 06:28:01 2015 +0000 +++ b/communication.cpp Sun Mar 01 08:48:23 2015 +0000 @@ -1,7 +1,7 @@ #include "mbed.h" #include "communication.h" -uint8_t COMMUNICATION::CommunicatePacket(ANDANTE_PROTOCOL_PACKET *packet) +uint8_t COMMUNICATION::receiveCommunicatePacket(ANDANTE_PROTOCOL_PACKET *packet) { uint8_t currentParameter = 0; bool isWholePacket = false; @@ -111,23 +111,18 @@ } } -#ifdef ANDANTE_DEBUG - pc->printf("Timer: %d ms\r\n", timer.read_ms()); -#endif - timer.stop(); if(!isWholePacket) { #ifdef ANDANTE_DEBUG pc->printf("Error: Read response timeout\r\n"); + pc->printf("Timer: %d ms\r\n", timer.read_ms()); #endif return ANDANTE_ERRBIT_READ_TIMEOUT; } - timer.reset(); - timer.start(); - + return ANDANTE_ERRBIT_NONE; } COMMUNICATION::COMMUNICATION(PinName tx, PinName rx, uint32_t baudRate, uint16_t tx_buff, uint16_t rx_buff )