Expand description
Driver for the XY7025 programmable buck converter (and protocol-compatible
siblings via Model::Custom).
These modules share a common Modbus-RTU register layout — see the
crate’s README.md for the full protocol reference.
use xy_modbus::{Model, Xy, SafetyLimits};
let mut xy = Xy::new(my_transport, Model::Xy7025);
xy.set_protection(SafetyLimits { lvp_v: 22.0, ovp_v: 15.0, ocp_a: 15.0 })?;
xy.set_voltage(13.5)?;
xy.set_current_limit(10.0)?;
xy.set_output(true)?;
let s = xy.read_status()?;
println!("{:.2} V @ {:.2} A", s.v_out, s.i_out);The crate is no_std. With the default embedded-io feature, the
uart module provides a ready-to-use ModbusTransport over any
embedded-io UART. To use a different transport, disable default
features and implement ModbusTransport yourself; the framing
module exposes the on-wire codec.
For esp-idf-hal users, the esp-idf-hal feature ships a convenience
constructor so you don’t need to write a UART wrapper:
ⓘ
use xy_modbus::{Model, Xy};
let mut xy = Xy::from_esp_uart(uart, Model::Xy7025);
xy.set_voltage(13.5)?;Re-exports§
pub use framing::FrameError;pub use transport::BlockingRead;pub use transport::ModbusError;pub use transport::ModbusTransport;pub use transport::RtuError;pub use uart::UartTransport;
Modules§
- framing
- Modbus-RTU on-wire framing — pure functions, no I/O.
- transport
- Modbus-RTU transport trait and error types.
- uart
- Default Modbus-RTU transport over a
BlockingRead+embedded_io::WriteUART.
Structs§
- Group
Params - All 14 registers of a memory group (M0–M9). Field order matches the on-wire register order.
- OnTime
- Output-on time as reported by the device (h/m/s).
- Safety
Limits - Hard trip limits programmed into the buck’s protection registers.
- Setpoints
- Output voltage / current setpoints (registers 0x0000–0x0001).
- Status
- Live + control snapshot covering registers 0x0000–0x0012 in a single 19-register transaction. Returns everything a supervisor needs each tick (live readings, regulation mode, latched protection cause, output-enable flag) in one Modbus round-trip.
- Temperatures
- Temperature readings from registers
0x000D(T-IN) and0x000E(T-EX), in the unit selected bysuper::TempUnit. - Totals
- Cumulative output counters and on-time (registers 0x0006–0x000C).
- Xy
- Driver for the XY-series buck converter.
Enums§
- Baud
Rate - Baud-rate codes for
BAUDRATE_L(register 0x0019). - Model
- 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. SeeDATASHEET.md§3 for the scale table. - Model
Check - Outcome of
crate::Xy::verify_model.Mismatchis the dangerous case — readings WILL be off by 10× until the configuredModelis changed to match the hardware. - Protection
Status - Latched protection cause read from
PROTECT(register 0x0010). - RegMode
- Regulation mode reported by
CVCC(register 0x0011). - Temp
Unit - Temperature unit selected by
F-C(register 0x0013).