You’re implementing a communication packet for transmission. Each packet is 6 bytes structured as follows:
Field | Size (bytes) |
Start Byte | 1 |
Command | 1 |
Data (2B) | 2 |
CRC | 1 |
End Byte | 1 |
Your task is to:
Example-1
Input: start = 0xA5, cmd = 0x01, data = 0x1234, crc = 0x77, end = 0x5A
Output: 165 1 52 18 119 90
Example-2
Input: start = 0xAA, cmd = 0xFF, data = 0x00FF, crc = 0xFE, end = 0x55
Output: 170 255 255 0 254 85
Input
165 1 4660 119 90
Expected Output
165 1 52 18 119 90