Frequency

Struct Frequency 

Source
pub struct Frequency(/* private fields */);
Expand description

Radio frequency in Hz.

Stored as a u32, matching the firmware’s internal representation. Range: 0 to 4,294,967,295 Hz (0 to ~4.295 GHz).

§TH-D75 band frequency ranges

Per service manual §2.1.2 (Table 1) and User Manual Chapter 28, the radio enforces hardware-specific frequency limits per band. The service manual frequency configuration points (A-E) map to the signal path in the receiver block diagrams (§2.1.3):

§TH-D75A (K type)

PointFrequency rangeFunction
A (TX/RX)144.000-147.995, 222.000-224.995, 430.000-449.995 MHzVCO/PLL output → 1st mixer
B (RX)136.000-173.995, 216.000-259.995, 410.000-469.995 MHzRF AMP → distribution circuit
C (RX)0.100-75.995, 108.000-523.995 MHzBand B wideband RX input
D (1st IF)193.150-231.145, 158.850-202.845, 352.850-412.845 MHzAfter 1st mixer (Band A)
E (1st IF)58.150-134.045, 166.050-465.945 MHzAfter 1st mixer (Band B)

§TH-D75E (E, T types)

PointFrequency rangeFunction
A (TX/RX)144.000-145.995, 430.000-439.995 MHzVCO/PLL output → 1st mixer
B (RX)136.000-173.995, 410.000-469.995 MHzRF AMP → distribution circuit
C (RX)0.100-75.995, 108.000-523.995 MHzBand B wideband RX input

Band A uses double super heterodyne (1st IF 57.15 MHz, 2nd IF 450 kHz). Band B uses triple super heterodyne (1st IF 58.05 MHz, 2nd IF 450 kHz, 3rd IF 10.8 kHz for AM/SSB/CW).

Frequencies outside these ranges will be rejected by the radio when sent via CAT commands such as FQ or FO. The firmware validates the frequency against the target band’s allowed range and returns a ? error response if the value is out of bounds. This library does not pre-validate frequencies to avoid duplicating firmware logic that may vary by region or firmware version.

Implementations§

Source§

impl Frequency

Source

pub const fn new(hz: u32) -> Self

Creates a new Frequency from a value in Hz.

No validation is performed; the full u32 range is accepted to match firmware behaviour.

Source

pub const fn as_hz(self) -> u32

Returns the frequency in Hz.

Source

pub fn as_khz(self) -> f64

Returns the frequency in kHz as a floating-point value.

Source

pub fn as_mhz(self) -> f64

Returns the frequency in MHz as a floating-point value.

Source

pub fn to_wire_string(self) -> String

Formats the frequency as a 10-digit zero-padded decimal string for CAT protocol wire transmission.

Example: 145 MHz becomes "0145000000".

Source

pub fn from_wire_string(s: &str) -> Result<Self, ProtocolError>

Parses a 10-digit decimal string from the CAT protocol into a Frequency.

§Errors

Returns ProtocolError::FieldParse if the string is not exactly 10 characters or contains non-numeric characters.

Source

pub const fn to_le_bytes(self) -> [u8; 4]

Returns the frequency as a 4-byte little-endian array.

Source

pub const fn from_le_bytes(bytes: [u8; 4]) -> Self

Creates a Frequency from a 4-byte little-endian array.

Trait Implementations§

Source§

impl Clone for Frequency

Source§

fn clone(&self) -> Frequency

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 Frequency

Source§

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

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

impl Display for Frequency

Source§

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

Formats the frequency in MHz with three decimal places.

Example: Frequency::new(145_190_000) displays as "145.190 MHz".

Source§

impl Hash for Frequency

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Frequency

Source§

fn cmp(&self, other: &Frequency) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Frequency

Source§

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

Source§

fn partial_cmp(&self, other: &Frequency) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Frequency

Source§

impl Eq for Frequency

Source§

impl StructuralPartialEq for Frequency

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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