ChannelMemory

Struct ChannelMemory 

Source
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: Frequency

RX frequency in Hz (byte 0x00, 4 bytes, little-endian).

§tx_offset: Frequency

TX offset or split TX frequency in Hz (byte 0x04, 4 bytes, little-endian).

§step_size: StepSize

Frequency step size (byte 0x08 high nibble).

§mode_flags_raw: u8

Raw 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: ShiftDirection

Shift 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: bool

Reverse mode (derived from flags_0a_raw bit 3).

§tone_enable: bool

Tone encode enable (derived from flags_0a_raw bit 7).

§ctcss_mode: CtcssMode

CTCSS mode (derived from flags_0a_raw bit 6).

§dcs_enable: bool

DCS enable (derived from flags_0a_raw bit 5).

§cross_tone_reverse: bool

Cross-tone enable (derived from flags_0a_raw bit 4).

§flags_0a_raw: u8

Raw 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: ToneCode

Tone encoder frequency code index (byte 0x0B).

§ctcss_code: ToneCode

CTCSS decoder frequency code index (byte 0x0C).

§dcs_code: DcsCode

DCS code index (byte 0x0D).

§cross_tone_combo: CrossToneType

Cross-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: FlashDigitalSquelch

Digital 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: ChannelName

D-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: u8

Digital code (CAT wire field 19, 2 digits).

Implementations§

Source§

impl ChannelMemory

Source

pub const BYTE_SIZE: usize = 40

Size of the packed binary representation in bytes.

Source

pub fn to_bytes(&self) -> [u8; 40]

Serializes the channel memory to a 40-byte packed binary array.

Source

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

Source§

fn clone(&self) -> ChannelMemory

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChannelMemory

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChannelMemory

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ChannelMemory

Source§

fn eq(&self, other: &ChannelMemory) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ChannelMemory

Source§

impl StructuralPartialEq for ChannelMemory

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more