pub struct ChannelMemory {Show 18 fields
pub rx_frequency: Frequency,
pub tx_offset: Frequency,
pub step_size: StepSize,
pub mode_flags_raw: u8,
pub shift: ShiftDirection,
pub reverse: bool,
pub tone_enable: bool,
pub ctcss_mode: CtcssMode,
pub dcs_enable: bool,
pub cross_tone_reverse: bool,
pub flags_0a_raw: u8,
pub tone_code: ToneCode,
pub ctcss_code: ToneCode,
pub dcs_code: DcsCode,
pub cross_tone_combo: CrossToneType,
pub digital_squelch: FlashDigitalSquelch,
pub urcall: ChannelName,
pub data_mode: u8,
}Expand description
40-byte internal channel memory structure.
Maps byte-for-byte to the firmware’s internal representation at DAT_c0012634.
See thd75/re_output/channel_memory_structure.txt.
§Channel display names
Channel display names are NOT accessible via the CAT
protocol. The urcall field stores the D-STAR URCALL destination callsign
from the ME/FO wire format (typically “CQCQCQ” for D-STAR). Display names
are only accessible via the MCP programming protocol on USB interface 2.
Fields§
§rx_frequency: FrequencyRX frequency in Hz (byte 0x00, 4 bytes, little-endian).
tx_offset: FrequencyTX offset or split TX frequency in Hz (byte 0x04, 4 bytes, little-endian).
step_size: StepSizeFrequency step size (byte 0x08 high nibble).
mode_flags_raw: u8Raw byte 0x09 — mode and fine tuning configuration.
Bit layout (from FlashChannel RE):
- bit 7: reserved
- bits 6:4: operating mode (0=FM, 1=DV, 2=AM, 3=LSB, 4=USB, 5=CW, 6=NFM)
- bit 3: narrow FM flag
- bit 2: fine tuning enable
- bits 1:0: fine step size
In the CAT wire format (FO/ME), byte[9] is unpacked into fields [3]-[6]:
tx_step, mode, fine_tuning, fine_step. The binary packer preserves
this byte directly for round-trip fidelity.
shift: ShiftDirectionShift direction (byte 0x08 low nibble in binary format).
In the binary packer, this field is written to byte 0x08 low nibble.
In the CAT wire format, shift is at field[12] and also encoded in
flags_0a_raw bits 2:0. Both should carry the same value.
reverse: boolReverse mode (derived from flags_0a_raw bit 3).
tone_enable: boolTone encode enable (derived from flags_0a_raw bit 7).
ctcss_mode: CtcssModeCTCSS mode (derived from flags_0a_raw bit 6).
dcs_enable: boolDCS enable (derived from flags_0a_raw bit 5).
cross_tone_reverse: boolCross-tone enable (derived from flags_0a_raw bit 4).
flags_0a_raw: u8Raw byte 0x0A — source of truth for tone/shift configuration.
Hardware-verified bit layout (20 channels, 0 exceptions):
- bit 7: tone encode enable
- bit 6: CTCSS enable
- bit 5: DCS enable
- bit 4: cross-tone enable
- bit 3: reverse
- bits 2:0: shift direction (0=simplex, 1=+, 2=-, 4=split)
The individual bool fields above are convenience accessors that
MUST be consistent with this byte. The binary packer (to_bytes)
writes this byte directly; from_bytes derives the bools from it.
tone_code: ToneCodeTone encoder frequency code index (byte 0x0B).
ctcss_code: ToneCodeCTCSS decoder frequency code index (byte 0x0C).
dcs_code: DcsCodeDCS code index (byte 0x0D).
cross_tone_combo: CrossToneTypeCross-tone combination type (byte 0x0E bits 5:4, range 0-3).
CAT wire field 16. Controls how TX and RX tone types are combined
when cross-tone mode is enabled (cross_tone_reverse / byte 0x0A bit 4).
digital_squelch: FlashDigitalSquelchDigital squelch mode (byte 0x0E bits 1:0, range 0-2).
CAT wire field 18: 0=Off, 1=Code Squelch, 2=Callsign Squelch. Note: channel lockout (ME field 22) is stored separately in MCP flags region at offset 0x2000, not here.
urcall: ChannelNameD-STAR URCALL destination callsign (byte 0x0F, 24 bytes).
Stores the D-STAR “UR” (your) callsign, defaulting to “CQCQCQ” for general CQ calls. Display names are stored separately in MCP at offset 0x10000.
data_mode: u8Digital code (CAT wire field 19, 2 digits).
Implementations§
Source§impl ChannelMemory
impl ChannelMemory
Sourcepub fn to_bytes(&self) -> [u8; 40]
pub fn to_bytes(&self) -> [u8; 40]
Serializes the channel memory to a 40-byte packed binary array.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, ProtocolError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ProtocolError>
Parses a channel memory from a byte slice (must be >= 40 bytes).
§Errors
Returns ProtocolError::FieldParse if any field contains an
invalid value, or if the slice is too short.
Trait Implementations§
Source§impl Clone for ChannelMemory
impl Clone for ChannelMemory
Source§fn clone(&self) -> ChannelMemory
fn clone(&self) -> ChannelMemory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more