Data Sheet

UM7 DATASHEET
Rev. 1.6 Released 1/10/2016
38
// Add the new byte to the checksum
computed_checksum += packet->data[index];
}
// Now see if our computed checksum matches the received checksum
// First extract the checksum from the packet
uint16_t received_checksum = (rx_data[packet_index + 5 + data_length] << 8);
received_checksum |= rx_data[packet_index + 6 + data_length];
// Now check to see if they don’t match
if( received_checksum != computed_checksum )
{
return 4;
}
// At this point, we’ve received a full packet with a good checksum. It is already
// fully parsed and copied to the ‘packet’ structure, so return 0 to indicate that a packet was
// processed.
return 0;
}
Once the packet has been parsed and copied into the packet structure, accessing the desired
data is as simple as watching for packets with the desired address, checking the data length to
make sure it is as long as you expect, and then pulling the data out of the packet’s data array.
GETTING THE FIRMWARE REVISION
To read the firmware revision from the UM7, a GET_FW_REVISION command should be sent to
the over the serial port. Recall that to initiate a command on the UM7, a read packet should be
sent using the command’s address in the ‘Address’ byte of the packet. For a GET_FW_REVISION
command, the address is 170 (0xAA).
C-code for constructing and sending the command is shown below:
uint8_t tx_data[20];
tx_data[0] = ‘s’;