uint8_t I2CTransfer::sendData(const uint16_t &messageLen, const uint8_t &packetID, const uint8_t &targetAddress=0) Description: ------------ * Send a specified number of bytes in packetized form Inputs: ------- * const uint16_t &messageLen - Number of values in txBuff to send as the payload in the next packet * const uint8_t &packetID - The packet 8-bit identifier * const ui
| 61 | * uint8_t numBytesIncl - Number of payload bytes included in packet |
| 62 | */ |
| 63 | uint8_t I2CTransfer::sendData(const uint16_t& messageLen, const uint8_t& packetID, const uint8_t& targetAddress) |
| 64 | { |
| 65 | uint8_t numBytesIncl; |
| 66 | |
| 67 | numBytesIncl = packet.constructPacket(messageLen, packetID); |
| 68 | |
| 69 | port->beginTransmission(targetAddress); |
| 70 | port->write(packet.preamble, sizeof(packet.preamble)); |
| 71 | port->write(packet.txBuff, numBytesIncl); |
| 72 | port->write(packet.postamble, sizeof(packet.postamble)); |
| 73 | port->endTransmission(); |
| 74 | |
| 75 | return numBytesIncl; |
| 76 | } |
| 77 | |
| 78 | |
| 79 | /* |
nothing calls this directly
no test coverage detected