FlashChannel

Struct FlashChannel 

Source
pub struct FlashChannel {
Show 29 fields pub rx_frequency: Frequency, pub tx_offset: Frequency, pub step_size: StepSize, pub byte08_low: u8, pub mode: MemoryMode, pub narrow: bool, pub fine_mode: bool, pub fine_step: FineStep, pub byte09_bit7: bool, pub tone_enabled: bool, pub ctcss_enabled: bool, pub dtcs_enabled: bool, pub cross_tone: bool, pub byte0a_bit3: bool, pub split: bool, pub duplex: FlashDuplex, pub tone_code: ToneCode, pub ctcss_code: ToneCode, pub byte0c_high: u8, pub dcs_code: DcsCode, pub byte0d_bit7: bool, pub cross_tone_type: CrossToneType, pub digital_squelch: FlashDigitalSquelch, pub byte0e_reserved: u8, pub ur_call: DstarCallsign, pub rpt1: DstarCallsign, pub rpt2: DstarCallsign, pub dv_code: u8, pub byte27_bit7: bool,
}
Expand description

40-byte flash memory channel structure.

Maps byte-for-byte to the MCP programming memory and .d75 file format. Field layout derived from firmware analysis.

This struct represents the flash encoding, which differs from the CAT wire format (ChannelMemory) in several ways:

  • Mode (byte 0x09 bits [6:4]): 8 modes including HF (LSB/USB/CW) and DR, vs 4 modes in CAT.
  • Tone/duplex (byte 0x0A): structured bit fields for tone, CTCSS, DTCS, cross-tone, split, and duplex direction.
  • D-STAR callsigns (bytes 0x0F-0x26): three separate 8-byte fields (UR, RPT1, RPT2) instead of one 24-byte blob.
  • Cross-tone / digital squelch (byte 0x0E): cross-tone type and per-channel digital squelch mode.

The per-field offsets documented on each struct member below are the complete byte map, correlated against MCP memory dumps from hardware.

Fields§

§rx_frequency: Frequency

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

§tx_offset: Frequency

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

§step_size: StepSize

Frequency step size (offset 0x08 bits [7:4]).

§byte08_low: u8

Raw low nibble of byte 0x08 (split tune step / unknown bit 0).

§mode: MemoryMode

Operating mode (offset 0x09 bits [6:4]).

§narrow: bool

Narrow FM flag (offset 0x09 bit 3).

§fine_mode: bool

Fine tuning mode enabled (offset 0x09 bit 2).

§fine_step: FineStep

Fine tuning step size (offset 0x09 bits [1:0]).

§byte09_bit7: bool

Raw bit 7 of byte 0x09 (unknown / reserved).

§tone_enabled: bool

Tone encode enable (offset 0x0A bit 7).

§ctcss_enabled: bool

CTCSS encode+decode enable (offset 0x0A bit 6).

§dtcs_enabled: bool

DTCS (DCS) enable (offset 0x0A bit 5).

§cross_tone: bool

Cross-tone mode enable (offset 0x0A bit 4).

§byte0a_bit3: bool

Raw bit 3 of byte 0x0A (unknown / reserved).

§split: bool

Odd split flag (offset 0x0A bit 2). When set, tx_offset is an absolute TX frequency rather than a repeater offset.

§duplex: FlashDuplex

Duplex direction (offset 0x0A bits [1:0]).

§tone_code: ToneCode

CTCSS TX tone index (offset 0x0B, 0-49).

§ctcss_code: ToneCode

CTCSS RX tone index (offset 0x0C bits [5:0]).

§byte0c_high: u8

Raw high bits of byte 0x0C (bits [7:6], unknown).

§dcs_code: DcsCode

DCS code index (offset 0x0D bits [6:0]).

§byte0d_bit7: bool

Raw bit 7 of byte 0x0D (unknown / reserved).

§cross_tone_type: CrossToneType

Cross-tone type (offset 0x0E bits [5:4]).

§digital_squelch: FlashDigitalSquelch

Digital squelch mode (offset 0x0E bits [1:0]).

§byte0e_reserved: u8

Raw bits of byte 0x0E that are not cross-tone or digital squelch (bits [7:6] and [3:2]).

§ur_call: DstarCallsign

D-STAR UR callsign (offset 0x0F, 8 bytes, space-padded).

§rpt1: DstarCallsign

D-STAR RPT1 callsign (offset 0x17, 8 bytes, space-padded).

§rpt2: DstarCallsign

D-STAR RPT2 callsign (offset 0x1F, 8 bytes, space-padded).

§dv_code: u8

D-STAR DV code (offset 0x27 bits [6:0], 0-127).

§byte27_bit7: bool

Raw bit 7 of byte 0x27 (unknown / reserved).

Implementations§

Source§

impl FlashChannel

Source

pub const BYTE_SIZE: usize = 40

Size of the packed binary representation in bytes.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, ProtocolError>

Parses a flash channel 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.

Source

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

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

Trait Implementations§

Source§

impl Clone for FlashChannel

Source§

fn clone(&self) -> FlashChannel

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 FlashChannel

Source§

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

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

impl Default for FlashChannel

Source§

fn default() -> Self

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

impl PartialEq for FlashChannel

Source§

fn eq(&self, other: &FlashChannel) -> 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 FlashChannel

Source§

impl StructuralPartialEq for FlashChannel

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