[][src]Trait gomspace_p31u_api::GsEps

pub trait GsEps: Send {
    fn new(bus: &str, addr: u8) -> EpsResult<Self>
    where
        Self: Sized
;
fn ping(&self) -> EpsResult<()>;
fn reset(&self) -> EpsResult<()>;
fn reboot(&self) -> EpsResult<()>;
fn configure_system(&self, config: EpsSystemConfig) -> EpsResult<()>;
fn configure_battery(&self, config: EpsBatteryConfig) -> EpsResult<()>;
fn save_battery_config(&self) -> EpsResult<()>;
fn set_output(&self, channel_mask: u8) -> EpsResult<()>;
fn set_single_output(
        &self,
        channel: EpsChannels,
        value: EpsPowerState,
        delay: u16
    ) -> EpsResult<()>;
fn set_input_value(
        &self,
        in1_voltage: u16,
        in2_voltage: u16,
        in3_voltage: u16
    ) -> EpsResult<()>;
fn set_input_mode(&self, mode: u8) -> EpsResult<()>;
fn set_heater(
        &self,
        heater: HeaterSelect,
        mode: EpsPowerState
    ) -> EpsResult<()>;
fn reset_system_config(&self) -> EpsResult<()>;
fn reset_battery_config(&self) -> EpsResult<()>;
fn reset_counters(&self) -> EpsResult<()>;
fn get_housekeeping(&self) -> EpsResult<EpsHk>;
fn get_system_config(&self) -> EpsResult<EpsSystemConfig>;
fn get_battery_config(&self) -> EpsResult<EpsBatteryConfig>;
fn get_heater(&self) -> EpsResult<i32>;
fn watchdog_kick(&self) -> EpsResult<()>;
fn passthrough(&self, tx: &[u8], rx: &mut [u8]) -> EpsResult<()>; }
[]

Trait used to represent the GsEps object. Allows for mock objects to be created for unit tests

Required methods

fn new(bus: &str, addr: u8) -> EpsResult<Self> where
    Self: Sized
[]

Construct a new GsEps instance

fn ping(&self) -> EpsResult<()>[]

Ping subsystems

fn reset(&self) -> EpsResult<()>[]

Reset

fn reboot(&self) -> EpsResult<()>[]

Reboot

fn configure_system(&self, config: EpsSystemConfig) -> EpsResult<()>[]

System configuration

fn configure_battery(&self, config: EpsBatteryConfig) -> EpsResult<()>[]

Battery configuration

fn save_battery_config(&self) -> EpsResult<()>[]

Battery configuration save

fn set_output(&self, channel_mask: u8) -> EpsResult<()>[]

Batch set EPS outputs

fn set_single_output(
    &self,
    channel: EpsChannels,
    value: EpsPowerState,
    delay: u16
) -> EpsResult<()>
[]

Set a channel on/off

fn set_input_value(
    &self,
    in1_voltage: u16,
    in2_voltage: u16,
    in3_voltage: u16
) -> EpsResult<()>
[]

Set MPPT input level

fn set_input_mode(&self, mode: u8) -> EpsResult<()>[]

Set the MPPT mode

fn set_heater(&self, heater: HeaterSelect, mode: EpsPowerState) -> EpsResult<()>[]

Set heater configuration

fn reset_system_config(&self) -> EpsResult<()>[]

Reset system configuration

fn reset_battery_config(&self) -> EpsResult<()>[]

Reset battery configuration

fn reset_counters(&self) -> EpsResult<()>[]

Reset conuters

fn get_housekeeping(&self) -> EpsResult<EpsHk>[]

Get the telemetry data

fn get_system_config(&self) -> EpsResult<EpsSystemConfig>[]

Get the system configuration

fn get_battery_config(&self) -> EpsResult<EpsBatteryConfig>[]

Get battery configuration

fn get_heater(&self) -> EpsResult<i32>[]

Get the heater status

fn watchdog_kick(&self) -> EpsResult<()>[]

Kick the hardware watchdog

fn passthrough(&self, tx: &[u8], rx: &mut [u8]) -> EpsResult<()>[]

Pass a data packet directly through to the device

Implementors

impl GsEps for Eps[src][]

fn new(bus: &str, addr: u8) -> EpsResult<Eps>[src][]

Constructor

Opens a connection to the underlying I2C device

Arguments

  • bus - The I2C bus to use to communicate with the device
  • I2C_addr - The I2C address of the EPS, Default 0x08
  • WD_timeout - The watchdog timeout interval, in seconds

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn ping(&self) -> EpsResult<()>[src][]

Ping the EPS. Send a cmd (1) to the eps. Expect the same command returned by the EPS

fn reset(&self) -> EpsResult<()>[src][]

Hard reset the EPS's microcontrollers

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn reboot(&self) -> EpsResult<()>[src][]

Soft reset the EPS's microcontrollers

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn configure_system(&self, config: EpsSystemConfig) -> EpsResult<()>[src][]

System Configuration (conf)

Set the system configuration

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn configure_battery(&self, config: EpsBatteryConfig) -> EpsResult<()>[src][]

Battery Configuration (conf2)

Set the battery configuration

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn save_battery_config(&self) -> EpsResult<()>[src][]

Save Battery Configuration

Save the battery configuration, must be done after battery configuration or it will fall back after a while

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn set_output(&self, channel_mask: u8) -> EpsResult<()>[src][]

Batch set EPS output

Set output switch states by a bitmask where "1" means the channel is switched on and "0" means it is switched off. LSB is channel 1, next bit is channel 2 etc. (Quadbat switch and heater cannot be controlled through this command) [NC NC 3.3V3 3.3V2 3.3V1 5V3 5V2 5V1]

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn set_single_output(
    &self,
    channel: EpsChannels,
    value: EpsPowerState,
    delay: u16
) -> EpsResult<()>
[src][]

Set single EPS output

Set output %channel% to value %value% with delay %delay%, Channel (0-5), Quadbat heater (6), Quadbat switch (7) Value 0 = Off, 1 = On Delay in seconds.

Example: set_single_output(0, 1, 0) This will set channel 0 to be ON with no delay

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn set_input_value(
    &self,
    in1_voltage: u16,
    in2_voltage: u16,
    in3_voltage: u16
) -> EpsResult<()>
[src][]

Set the MPPT value for each channel

Set the voltage on the photo-voltaic inputs V1, V2, V3 in mV. Takes effect when MODE = 2, See SET_PV_AUTO. Transmit voltage1 first and voltage3 last.

The voltage needs to changed to align with the number of solar panels you have on each channel

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn set_input_mode(&self, mode: u8) -> EpsResult<()>[src][]

Set the MPPT mode

Sets the solar cell power tracking mode: MODE = 0: Hardware default power point MODE = 1: Maximum power point tracking MODE = 2: Fixed software powerpoint, value set with SET_PV_VOLT, default 4V

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn set_heater(&self, heater: HeaterSelect, mode: EpsPowerState) -> EpsResult<()>[src][]

Set heater ON/OFF

Cmd = 0: Set heater on/off Heater: 0 = BP4, 1= Onboard, 2 = Both Mode: 0 = OFF, 1 = ON

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn reset_system_config(&self) -> EpsResult<()>[src][]

Reset the EPS configuration to default

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn reset_battery_config(&self) -> EpsResult<()>[src][]

Reset the Battery configuration to default

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn reset_counters(&self) -> EpsResult<()>[src][]

Reset boot counter and WDT counters (excluding the dedicated WDT)

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn get_housekeeping(&self) -> EpsResult<EpsHk>[src][]

Get Housekeeping data

HK structure:

vboost[3] : Voltage of input voltage boost converters [mV] vbatt : Voltage of battery [mV]
curin[3] : Input currents [mA]
cursun : Current from boost converters [mA]
cursys : Current out of battery [mA]
reserved1 : Reserved for future use
curout[6] : Output currents [mA]
output[8] : Output statuses [0 = Off, 1 = On]
output_on_delta[8] : Time until output power on [seconds]
output_off_delta[8] : Time until output power off [seconds]
latchup[6] : Number of output latch-up events
wdt_i2c_time_left : Time left for I2C watchdog [seconds]
wdt_gnd_time_left : Time left for dedicated watchdog [seconds]
wdt_csp_pings_left[2] : Pings left for CSP watchdog
counter_wdt_i2c : Number of I2C watchdog reboots
counter_wdt_gnd : Number of dedicated watchdog reboots
counter_wdt_csp[2] : Number of CSP watchdog reboots
counter_boot : Number of EPS reboots
temp[6] : Temperatures [degC] [0 = Temp1, Temp2, Temp3, Temp4, BP4a, BP4b]
boot_cause : Cause of last EPS reset
batt_mode : Mode for battery [0 = Initial, 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full]
ppt_mode : Mode of power-point tracker [1 = Automatic maximum, 2 = Fixed]
reserved2 : Reserved

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn get_system_config(&self) -> EpsResult<EpsSystemConfig>[src][]

Query the system configuration (conf)

Arguments

pub ppt_mode: u8, pub battheater_mode: u8, pub battheater_low:i8, pub battheater_high:i8, pub output_normal_value:[u8;8], pub output_safe_value:[u8;8], pub output_initial_on_delay:[u16;8], pub output_initial_off_delay:[u16;8], pub vboost:[u16;3],

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn get_battery_config(&self) -> EpsResult<EpsBatteryConfig>[src][]

Get the battery configuration (conf2)

Arguments

batt_maxvoltage: 0, batt_safevoltage: 0, batt_criticalvoltage:0, batt_normalvoltage:0, reserved1:[0;2], reserved2:[0;4],

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn get_heater(&self) -> EpsResult<i32>[src][]

Get heater status

Command replies with heater modes. 0=OFF, 1=ON.

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn watchdog_kick(&self) -> EpsResult<()>[src][]

Kick Watchdog

Send this command to reset (kick) dedicated WDT. magic = 0x78

Errors

If this function encounters any errors, an [EpsError] variant will be returned.

fn passthrough(&self, tx: &[u8], rx: &mut [u8]) -> EpsResult<()>[src][]

Command pass through function. Pass the infromation through

Errors

If this function encounters any errors, an [EpsError] variant will be returned.