pub trait LTC681XClient<T: DeviceTypes, const L: usize> {
    type Error;

    // Required methods
    fn start_conv_cells(
        &mut self,
        mode: ADCMode,
        cells: T::CellSelection,
        dcp: bool
    ) -> Result<CommandTime, Self::Error>;
    fn start_conv_gpio(
        &mut self,
        mode: ADCMode,
        pins: T::GPIOSelection
    ) -> Result<CommandTime, Self::Error>;
    fn start_overlap_measurement(
        &mut self,
        mode: ADCMode,
        dcp: bool
    ) -> Result<(), Self::Error>;
    fn measure_internal_parameters(
        &mut self,
        mode: ADCMode,
        group: StatusGroup
    ) -> Result<CommandTime, Self::Error>;
    fn read_register(
        &mut self,
        register: T::Register
    ) -> Result<[[u16; 3]; L], Self::Error>;
    fn write_register(
        &mut self,
        register: T::Register,
        data: [[u8; 6]; L]
    ) -> Result<(), Self::Error>;
    fn write_configuration(
        &mut self,
        config: [Configuration; L]
    ) -> Result<(), Self::Error>;
    fn read_voltages<R: RegisterLocator<T> + 'static>(
        &mut self,
        locator: R
    ) -> Result<Vec<Vec<Voltage<T>, 18>, L>, Self::Error>
       where T: 'static;
    fn read_overlap_result(&mut self) -> Result<[[u16; 4]; L], Self::Error>;
    fn read_internal_device_parameters(
        &mut self
    ) -> Result<Vec<InternalDeviceParameters, L>, Self::Error>;
}
Expand description

Public LTC681X client interface

L: Number of LTC681X devices in daisy chain

Required Associated Types§

Required Methods§

source

fn start_conv_cells( &mut self, mode: ADCMode, cells: T::CellSelection, dcp: bool ) -> Result<CommandTime, Self::Error>

Starts ADC conversion of cell voltages

§Arguments
  • mode: ADC mode
  • cells: Measures the given cell group
  • dcp: True if discharge is permitted during conversion
source

fn start_conv_gpio( &mut self, mode: ADCMode, pins: T::GPIOSelection ) -> Result<CommandTime, Self::Error>

Starts GPIOs ADC conversion

§Arguments
  • mode: ADC mode
  • channels: Measures t:he given GPIO group
source

fn start_overlap_measurement( &mut self, mode: ADCMode, dcp: bool ) -> Result<(), Self::Error>

Start the Overlap Measurements (ADOL command) Note: This command is not available on LTC6810, as this device only includes one ADC

§Arguments
  • mode: ADC mode
  • dcp: True if discharge is permitted during conversion
source

fn measure_internal_parameters( &mut self, mode: ADCMode, group: StatusGroup ) -> Result<CommandTime, Self::Error>

Starts measuring internal device parameters (ADSTAT command)

§Arguments
  • mode: ADC mode
  • group: Selection of status parameter to measure
source

fn read_register( &mut self, register: T::Register ) -> Result<[[u16; 3]; L], Self::Error>

Reads the values of the given register Returns one array for each device in daisy chain

source

fn write_register( &mut self, register: T::Register, data: [[u8; 6]; L] ) -> Result<(), Self::Error>

Writes the values of the given register One 3-bytes array per device in daisy chain

source

fn write_configuration( &mut self, config: [Configuration; L] ) -> Result<(), Self::Error>

Writes the configuration, one array item per device in daisy chain

source

fn read_voltages<R: RegisterLocator<T> + 'static>( &mut self, locator: R ) -> Result<Vec<Vec<Voltage<T>, 18>, L>, Self::Error>
where T: 'static,

Reads and returns the conversion result (voltages) of Cell or GPIO group Returns one vector for each device in daisy chain

Vector needs to have a fixed capacity until feature generic_const_exprs is stable

source

fn read_overlap_result(&mut self) -> Result<[[u16; 4]; L], Self::Error>

Reads and returns the results of the overlap measurement

Index 0: Result of ADC A of first cell* Index 1: Result of ADC B of first cell* Index 2: Result of ADC A of second cell* Index 3: Result of ADC B of second cell*

  • Number of cells depends on the device type, otherwise 0 value is used
source

fn read_internal_device_parameters( &mut self ) -> Result<Vec<InternalDeviceParameters, L>, Self::Error>

Reads internal device parameters measured by ATOL command Returns one array item for each device in daisy chain

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<B, CS, P, T, const L: usize> LTC681XClient<T, L> for LTC681X<B, CS, P, T, L>
where B: Transfer<u8>, CS: OutputPin, P: PollMethod<CS>, T: DeviceTypes,

§

type Error = Error<B, CS>