void edpRunCommand(uint8_t destEdpAddr, uint8_t cmdLength, uint8_t* cmdBuffer) { uint8_t response; EdpReply* edpReply; uint8_t retval; EdpCommand* edpCommand = (EdpCommand*)cmdBuffer; // send command rprintf("Sending Command: 0x%x '%c' ->",edpCommand->Command,edpCommand->Command); retval = edpSendCommand(destEdpAddr, cmdLength, edpCommand); // handle result values if(retval == EDP_COMMAND_OK) { // command sent successfully rprintfProgStrM("Send Success!\r\n"); } else if(retval == EDP_COMMAND_NODEV) { // device did not exist rprintfProgStrM("Send Failed->NO DEVICE!\r\n"); rprintf("No EDP device could be contacted at address 0x%x.\r\n", destEdpAddr); rprintfProgStrM("The device may be busy or not responding.\r\n"); rprintfProgStrM("Check target device and I2C bus cabling.\r\n"); // return immediately return; } else { // other error rprintfProgStrM("Send Failed->Unspecified Error!\r\n"); // return immediately return; } // get the reply, if any, from the command retval = edpGetCommandReply(&response, &edpReply); // handle result values if(retval == EDP_REPLY_BADCHKSUM) { rprintf("**** Reply has bad checksum ****\r\n"); } // display the reply edpDisplayReply(response, edpReply); }
void erpDisplayEdpReply(u08 length, ErpEdpReply* erpEdpReply) { // print embedded EDP reply edpDisplayReply(erpEdpReply->EdpResponse, &erpEdpReply->EdpReply); }