Skip to main content

encode_cltu

Function encode_cltu 

Source
pub fn encode_cltu(
    tc_frame_bytes: &[u8],
    output_buffer: &mut [u8],
) -> Result<usize, CltuError>
Expand description

Encodes a TC Transfer Frame byte slice into a CLTU in the provided buffer.

This function performs two critical operations for uplink reliability:

  1. It applies a (63, 56) Bose-Chaudhuri-Hocquhem (BCH) forward error-correction code, which allows the spacecraft to automatically correct bit errors.
  2. It wraps the encoded data with a standard Start Sequence and Tail Sequence to ensure the spacecraft’s radio can reliably detect the beginning and end of the command.

The provided tc_frame_bytes should typically be randomized before calling this function.

Returns the total number of bytes written to the output buffer.