Crate ka3005p

Source
Expand description

This library helps connect to common power lab bench supplies from Tenma, Farnell, Stamos, Korad, Velleman, RS and various other clones. A quick example of using the library:

use ka3005p::{Ka3005p, Command, Switch};

// There is a helper function to automatically find the power supply
let mut dev = ka3005p::find_serial_port().unwrap();
// or if you wish to target a particular serial power
let mut dev = Ka3005p::new("dev/ttyS0").unwrap();

println!("{}", dev.status().unwrap());
// "Voltage: 12.00, Current: 0.305, Channel1: CV, Channel2: CV, Lock: Off, Beep: On, Output: On"

// Switching the power supply off
dev.execute(Command::Power(Switch::Off)).unwrap();
// Setting the voltage to 12.1v
dev.execute(Command::Voltage(12.1)).unwrap();

You can also use the accompanying command line utility:

> ka3005p status
Voltage: 12.00, Current: 0.305, Channel1: CV, Channel2: CV, Lock: Off, Beep: On, Output: On
> ka3005p power off
Voltage: 12.00, Current: 0.305, Channel1: CV, Channel2: CV, Lock: Off, Beep: On, Output: Off
> ka3005p voltage 12.1

Re-exports§

pub use serialport;

Structs§

Flags
Structure containing all the information fields from the power supply
Ka3005p
The power supply. The main object of the library.
Status
Contains the current Voltage, Current and Flags of the power supply

Enums§

Channel
Channel One / Two
Command
Commands supported by the power supply.
Lock
Locked / Unlocked
Mode
CC or CV mode
Switch
On / Off

Functions§

find_serial_port
Helper function that automatically finds and connects to a power supply.
list_serial_ports
A helper function to list all of the detected power supplies.