pub enum Model {
Xy7025,
Custom {
current_scale: u16,
power_scale: u16,
opp_scale: u16,
},
}Expand description
Hardware variant. Selected at construction (Xy::new) and used to
scale the registers whose resolution differs across the family —
I-SET, IOUT, S-OCP, POWER, S-OPP. See DATASHEET.md §3 for the
scale table.
Cross-check by reading MODEL (0x0016): 0x6500 is XY7025
(newer firmware revision observed in 2024+ batches; older vendor
docs cite 0x6100 for the same protocol). The crate does not
probe automatically — pick the variant that matches your hardware.
Variants§
Xy7025
Custom
Escape hatch for hardware not covered by the preset variants.
Each scale is the integer denominator the firmware uses on the
wire — e.g. current_scale = 100 means a raw register value of
1234 represents 12.34 A. The XY firmware uses integer
denominators on every known variant; cross-check against the
vendor docs for your unit.
Implementations§
Source§impl Model
impl Model
Sourcepub const fn current_scale(self) -> f32
pub const fn current_scale(self) -> f32
Scale for I-SET, IOUT, S-OCP. 100 on XY7025 (10 mA).
Sourcepub const fn power_scale(self) -> f32
pub const fn power_scale(self) -> f32
Scale for POWER (0x0004). 10 on XY7025 (100 mW).
Sourcepub const fn expected_model_code(self) -> Option<u16>
pub const fn expected_model_code(self) -> Option<u16>
Expected value of the device’s MODEL register (0x0016) for
this variant, if known. Used by crate::Xy::verify_model to
catch wrong-scale-family misconfiguration.
XY7025 returns 0x6500. Custom returns None (no canonical code).