Constructor
Opens a connection to the underlying I2C device
- bus - The I2C bus to use to communicate with the device
- primary - The I2C address of the system's primary microcontroller
- secondary - The I2C address of the system's secondary microcontroller
(should be
0x00
if no secondary microcontroller is available)
- ant_count - The number of antennas present in the antenna system
- timeout - The watchdog timeout interval, in seconds
If this function encounters any errors, an AntsError
variant will be returned.
use isis_ants_api::*;
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
Configure the system to send future commands to the requested microcontroller
- config - The microcontroller which should be used for future commands to the antenna system
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x00, 2, 20)?;
ants.configure(KANTSController::Secondary)?;
Reset both of the antenna's microcontrollers
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
ants.reset()?;
Arm the antenna system for deployment
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
ants.arm()?;
Disarm the antenna system
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
ants.disarm()?;
Deploy a particular antenna
- antenna - The antenna to deploy
- force - Whether the system should ignore previous successful deployment
- timeout - The maximum time, in seconds, the system should spend deploying the antenna
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x00, 2, 20)?;
ants.deploy(KANTSAnt::Ant2, false, 10)?;
Auto-deploy all antennas sequentially.
- timeout - The maximum time, in seconds, the system should spend deploying each antenna
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x00, 2, 20)?;
ants.auto_deploy(5)?;
Cancel all current deployment actions
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
ants.cancel_deploy()?;
Get the current deployment status
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
let deploy = ants.get_deploy()?;
println!("Antenna 1 deployed: {}", !deploy.ant_1_not_deployed);
println!("Antenna 2 deployment active: {}", deploy.ant_2_active);
Get the system's uptime
Returns the systems uptime, in seconds
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
let uptime = ants.get_uptime()?;
println!("Antenna system uptime: {}", uptime);
Get the current system telemetry
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
let sys_telem = ants.get_system_telemetry()?;
println!("Antenna system telemetry:");
println!(" raw_temp: {}", sys_telem.raw_temp);
println!(" deploy_status:");
println!(" Antenna 1 deployed: {}", !sys_telem.deploy_status.ant_1_not_deployed);
println!(" Antenna 2 deployment active: {}", sys_telem.deploy_status.ant_2_active);
println!(" uptime: {}\n", sys_telem.uptime);
Get an antenna's activation count
- antenna - Antenna to query
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x00, 2, 20)?;
let act_count = ants.get_activation_count(KANTSAnt::Ant3)?;
println!("Antenna 3 activation count - {}", act_count);
Get an antenna's activation time
Returns the total amount of time spent attempting to active the antenna, in seconds
- antenna - Antenna to query
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x00, 2, 20)?;
let act_count = ants.get_activation_time(KANTSAnt::Ant1)?;
println!("Antenna 1 activation time - {}", act_count);
Kick both antenna system's watchdogs once
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
ants.watchdog_kick()?;
Start a thread to kick the system's watchdogs at an interval of
(timeout)/3 seconds
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
ants.watchdog_start()?;
Stop the watchdog thread
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x32, 4, 10)?;
ants.watchdog_start()?;
ants.watchdog_stop()?;
Pass a command packet directly through to the antenna system
Useful for executing commands which have not been implemented in either the
generic or specific antenna APIs.
- tx - Reference to byte array data to send
- rx - Reference to byte array which returned data should be stored in
If this function encounters any errors, an AntsError
variant will be returned.
let ants = AntS::new("KI2C1", 0x31, 0x00, 2, 20)?;
let tx: [u8; 1] = [0xC3];
let mut rx: [u8; 2] = [0; 2];
ants.passthrough(&tx, &mut rx).unwrap();
println!("Antenna passthrough response: {:?}", rx);