pub trait Device<const NUM_OF_DEVICES: usize> {
type Error;
Show 20 methods
// Required methods
async fn read_cfga(&mut self) -> Result<[CfgA; NUM_OF_DEVICES], Self::Error>;
async fn read_cfgb(&mut self) -> Result<[CfgB; NUM_OF_DEVICES], Self::Error>;
async fn read_cva(&mut self) -> Result<[CvA; NUM_OF_DEVICES], Self::Error>;
async fn read_cvb(&mut self) -> Result<[CvB; NUM_OF_DEVICES], Self::Error>;
async fn read_cvc(&mut self) -> Result<[CvC; NUM_OF_DEVICES], Self::Error>;
async fn read_cvd(&mut self) -> Result<[CvD; NUM_OF_DEVICES], Self::Error>;
async fn read_cve(&mut self) -> Result<[CvE; NUM_OF_DEVICES], Self::Error>;
async fn read_cvf(&mut self) -> Result<[CvF; NUM_OF_DEVICES], Self::Error>;
async fn read_auxa(&mut self) -> Result<[AuxA; NUM_OF_DEVICES], Self::Error>;
async fn read_auxb(&mut self) -> Result<[AuxB; NUM_OF_DEVICES], Self::Error>;
async fn read_auxc(&mut self) -> Result<[AuxC; NUM_OF_DEVICES], Self::Error>;
async fn read_auxd(&mut self) -> Result<[AuxD; NUM_OF_DEVICES], Self::Error>;
async fn write_cfga(
&mut self,
reg: [CfgA; NUM_OF_DEVICES],
) -> Result<(), Self::Error>;
async fn write_cfgb(
&mut self,
reg: [CfgB; NUM_OF_DEVICES],
) -> Result<(), Self::Error>;
async fn convert_cells(
&mut self,
cmd: Adcv,
) -> Result<[CellRegisters; NUM_OF_DEVICES], Self::Error>;
async fn convert_gpios(
&mut self,
cmd: Adax,
) -> Result<[AuxRegisters; NUM_OF_DEVICES], Self::Error>;
async fn perform_overlap_tests(
&mut self,
cmd: Adol,
) -> Result<(), Self::Error>;
async fn perform_accuracy_check(
&mut self,
conv_setting: MDSetting,
) -> Result<(), Self::Error>;
async fn convert_cells_and_gpios(
&mut self,
cmd_cells: Adcv,
cmd_gpios: Adax,
) -> Result<([CellRegisters; NUM_OF_DEVICES], [AuxRegisters; NUM_OF_DEVICES]), Self::Error>;
async fn wake(&mut self) -> Result<(), Self::Error>;
}Expand description
Trait defining all high-level functions of the ltc681x chip family
Required Associated Types§
Required Methods§
Sourceasync fn read_cfga(&mut self) -> Result<[CfgA; NUM_OF_DEVICES], Self::Error>
async fn read_cfga(&mut self) -> Result<[CfgA; NUM_OF_DEVICES], Self::Error>
Reads content of all CfgA Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_cfgb(&mut self) -> Result<[CfgB; NUM_OF_DEVICES], Self::Error>
async fn read_cfgb(&mut self) -> Result<[CfgB; NUM_OF_DEVICES], Self::Error>
Reads content of all CfgB Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_cva(&mut self) -> Result<[CvA; NUM_OF_DEVICES], Self::Error>
async fn read_cva(&mut self) -> Result<[CvA; NUM_OF_DEVICES], Self::Error>
Reads content of all CvA Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_cvb(&mut self) -> Result<[CvB; NUM_OF_DEVICES], Self::Error>
async fn read_cvb(&mut self) -> Result<[CvB; NUM_OF_DEVICES], Self::Error>
Reads content of all CvB Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_cvc(&mut self) -> Result<[CvC; NUM_OF_DEVICES], Self::Error>
async fn read_cvc(&mut self) -> Result<[CvC; NUM_OF_DEVICES], Self::Error>
Reads content of all CvC Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_cvd(&mut self) -> Result<[CvD; NUM_OF_DEVICES], Self::Error>
async fn read_cvd(&mut self) -> Result<[CvD; NUM_OF_DEVICES], Self::Error>
Reads content of all CvD Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_cve(&mut self) -> Result<[CvE; NUM_OF_DEVICES], Self::Error>
async fn read_cve(&mut self) -> Result<[CvE; NUM_OF_DEVICES], Self::Error>
Reads content of all CvE Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_cvf(&mut self) -> Result<[CvF; NUM_OF_DEVICES], Self::Error>
async fn read_cvf(&mut self) -> Result<[CvF; NUM_OF_DEVICES], Self::Error>
Reads content of all CvF Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_auxa(&mut self) -> Result<[AuxA; NUM_OF_DEVICES], Self::Error>
async fn read_auxa(&mut self) -> Result<[AuxA; NUM_OF_DEVICES], Self::Error>
Reads content of all AuxA Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_auxb(&mut self) -> Result<[AuxB; NUM_OF_DEVICES], Self::Error>
async fn read_auxb(&mut self) -> Result<[AuxB; NUM_OF_DEVICES], Self::Error>
Reads content of all AuxB Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_auxc(&mut self) -> Result<[AuxC; NUM_OF_DEVICES], Self::Error>
async fn read_auxc(&mut self) -> Result<[AuxC; NUM_OF_DEVICES], Self::Error>
Reads content of all AuxC Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn read_auxd(&mut self) -> Result<[AuxD; NUM_OF_DEVICES], Self::Error>
async fn read_auxd(&mut self) -> Result<[AuxD; NUM_OF_DEVICES], Self::Error>
Reads content of all AuxD Registers
§Errors
Register reads are infallible from the Device point-of-view.
Only returns DriverErrors in case of communication issues
Sourceasync fn write_cfga(
&mut self,
reg: [CfgA; NUM_OF_DEVICES],
) -> Result<(), Self::Error>
async fn write_cfga( &mut self, reg: [CfgA; NUM_OF_DEVICES], ) -> Result<(), Self::Error>
Writes content to CfgA Register
Pay attention to the “index to device logic relationship” of the array argument.
See crate-level documentation of NUM_OF_DEVICES
§Errors
Writing to a register is infallible apart from DriverErrors
Only returns DriverErrors in case of communication issues
Sourceasync fn write_cfgb(
&mut self,
reg: [CfgB; NUM_OF_DEVICES],
) -> Result<(), Self::Error>
async fn write_cfgb( &mut self, reg: [CfgB; NUM_OF_DEVICES], ) -> Result<(), Self::Error>
Writes content to CfgB Register
Pay attention to the index to device logic of the payload array argument. See chapter Defining number of devices
§Errors
Writing to a register should is infallible apart from DriverErrors
Only returns DriverErrors in case of communication issues
Sourceasync fn convert_cells(
&mut self,
cmd: Adcv,
) -> Result<[CellRegisters; NUM_OF_DEVICES], Self::Error>
async fn convert_cells( &mut self, cmd: Adcv, ) -> Result<[CellRegisters; NUM_OF_DEVICES], Self::Error>
Writes content to CfgB Register
Pay attention to the index to device logic of the payload array argument. See chapter Defining number of devices
§Errors
Performing a conversion is infallible apart from DriverErrors
Only returns DriverErrors in case of communication issues
Sourceasync fn convert_gpios(
&mut self,
cmd: Adax,
) -> Result<[AuxRegisters; NUM_OF_DEVICES], Self::Error>
async fn convert_gpios( &mut self, cmd: Adax, ) -> Result<[AuxRegisters; NUM_OF_DEVICES], Self::Error>
Converts the gpio channels with the given Adax command.
§Errors
Performing a conversion is infallible apart from DriverErrors
Only returns DriverErrors in case of communication issues
Sourceasync fn perform_overlap_tests(&mut self, cmd: Adol) -> Result<(), Self::Error>
async fn perform_overlap_tests(&mut self, cmd: Adol) -> Result<(), Self::Error>
Performs the overlapping diagnostic test as described in the datasheet
Uses the given Adol and performs the overlapping conversion of Cell 7 and Cell 13 (in case of LTC6812/13).
Results of both conversion are read back and compared against a deviation of 100 digits between both ADCs.
This is inline with the definition from the datasheet
§Errors
- Returns
DriverErrorsin case of communication issues - Returns
Overlapwhen diagnostic logic is violated
Sourceasync fn perform_accuracy_check(
&mut self,
conv_setting: MDSetting,
) -> Result<(), Self::Error>
async fn perform_accuracy_check( &mut self, conv_setting: MDSetting, ) -> Result<(), Self::Error>
Performs the accuracy check with the given MDSettings
Only ScndRef channel is converted with the given settings.
The result for the second reference is compared against the bounds of the datasheet.
§Errors
- Returns
AccuracyFailedif accuracy selftest fails - Returns
Error::DriverErrorin case of communication problems
Sourceasync fn convert_cells_and_gpios(
&mut self,
cmd_cells: Adcv,
cmd_gpios: Adax,
) -> Result<([CellRegisters; NUM_OF_DEVICES], [AuxRegisters; NUM_OF_DEVICES]), Self::Error>
async fn convert_cells_and_gpios( &mut self, cmd_cells: Adcv, cmd_gpios: Adax, ) -> Result<([CellRegisters; NUM_OF_DEVICES], [AuxRegisters; NUM_OF_DEVICES]), Self::Error>
Combiniation of convert_cells and convert_gpios called after another
§Errors
Performing a conversion is infallible apart from DriverErrors
Only returns DriverErrors in case of communication issues
Sourceasync fn wake(&mut self) -> Result<(), Self::Error>
async fn wake(&mut self) -> Result<(), Self::Error>
Wakes the chip and the ISO SPI port (if used) by sending 12 Dummy Bytes per device
12 * NUM_OF_DEVICES = total number of bytes send
for details see timing in the driver or in the datasheet
§Errors
Writing to the SPI Bus is infallible apart from DriverErrors
Only returns DriverErrors in case of a hardware defect.
This command only writes dummy bytes to the SPI Bus with no reaction expected
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".