void Packet::stuffPacket(uint8_t arr[], const uint8_t &len) Description: ------------ * Enforces the COBS (Consistent Overhead Stuffing) ruleset across all bytes in the packet against the value of START_BYTE Inputs: ------- * uint8_t arr[] - Array of values to stuff * const uint8_t &len - Number of elements in arr[] Return: ------- * void */
| 373 | * void |
| 374 | */ |
| 375 | void Packet::stuffPacket(uint8_t arr[], const uint8_t& len) |
| 376 | { |
| 377 | int16_t refByte = findLast(arr, len); |
| 378 | |
| 379 | if (refByte != -1) |
| 380 | { |
| 381 | for (uint8_t i = (len - 1); i != 0xFF; i--) |
| 382 | { |
| 383 | if (arr[i] == START_BYTE) |
| 384 | { |
| 385 | arr[i] = refByte - i; |
| 386 | refByte = i; |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | |
| 393 | /* |
nothing calls this directly
no outgoing calls
no test coverage detected