Skip to main content

build_control_bytes

Function build_control_bytes 

Source
pub fn build_control_bytes(
    address: u8,
    frequency: u64,
    sample_rate_index: u8,
    ptt: bool,
    nddc: u8,
    rx_attenuation: u8,
    tx_drive: u8,
) -> [u8; 5]
Expand description

Build the 5 control bytes [C0, C1, C2, C3, C4] for a given address in the P1 control rotation.

This covers the common host-to-radio control addresses used by simple clients. Addresses handled:

  • 0x00: Sample rate, NDC count
  • 0x02..0x0E: NCO frequency for DDC channels (TX freq or RX freq)
  • 0x12: TX drive level
  • 0x14: RX step attenuator

frequency: VFO frequency in Hz. sample_rate_index: Sample rate index (0=48k, 1=96k, 2=192k, 3=384k). ptt: Push-to-talk state. nddc: Number of active DDC channels. rx_attenuation: RX attenuation in dB (0-31). tx_drive: TX drive level (0-255).