Skip to main content

AS5600Interface

Trait AS5600Interface 

Source
pub trait AS5600Interface {
    type Error;

Show 15 methods // Required methods fn read_raw_angle(&mut self) -> Result<u16, AS56Error<Self::Error>>; fn read_angle(&mut self) -> Result<u16, AS56Error<Self::Error>>; fn get_magnet_status( &mut self, ) -> Result<MagnetStatus, AS56Error<Self::Error>>; fn get_status_raw(&mut self) -> Result<u8, AS56Error<Self::Error>>; fn get_magnitude(&mut self) -> Result<u16, AS56Error<Self::Error>>; fn get_agc(&mut self) -> Result<u8, AS56Error<Self::Error>>; fn get_burn_count(&mut self) -> Result<u8, AS56Error<Self::Error>>; fn get_config(&mut self) -> Result<Configuration, AS56Error<Self::Error>>; fn set_config( &mut self, config: Configuration, ) -> Result<(), AS56Error<Self::Error>>; fn get_zero_position(&mut self) -> Result<u16, AS56Error<Self::Error>>; fn set_zero_position( &mut self, angle: u16, ) -> Result<(), AS56Error<Self::Error>>; fn get_max_position(&mut self) -> Result<u16, AS56Error<Self::Error>>; fn set_max_position( &mut self, angle: u16, ) -> Result<(), AS56Error<Self::Error>>; fn get_max_angle(&mut self) -> Result<u16, AS56Error<Self::Error>>; fn set_max_angle( &mut self, angle: u16, ) -> Result<(), AS56Error<Self::Error>>;
}
Expand description

A common interface for any AS5600-compatible sensor (real or simulated).

This trait allows writing generic code that works with both the real hardware driver and the mock implementation for testing.

Required Associated Types§

Source

type Error

The error type returned by the sensor methods.

Required Methods§

Source

fn read_raw_angle(&mut self) -> Result<u16, AS56Error<Self::Error>>

Reads the raw 12-bit angle from the Hall sensors.

Source

fn read_angle(&mut self) -> Result<u16, AS56Error<Self::Error>>

Reads the 12-bit angle after applying all settings.

Source

fn get_magnet_status(&mut self) -> Result<MagnetStatus, AS56Error<Self::Error>>

Returns the current magnet status and field strength health.

Source

fn get_status_raw(&mut self) -> Result<u8, AS56Error<Self::Error>>

Returns the raw value of the status register.

Source

fn get_magnitude(&mut self) -> Result<u16, AS56Error<Self::Error>>

Returns the magnitude value from the Hall sensors.

Source

fn get_agc(&mut self) -> Result<u8, AS56Error<Self::Error>>

Returns the current Automatic Gain Control (AGC) value.

Source

fn get_burn_count(&mut self) -> Result<u8, AS56Error<Self::Error>>

Returns the number of times the settings have been permanently burned to the chip.

Source

fn get_config(&mut self) -> Result<Configuration, AS56Error<Self::Error>>

Reads the current full configuration from the chip.

Source

fn set_config( &mut self, config: Configuration, ) -> Result<(), AS56Error<Self::Error>>

Writes a new configuration to the chip’s volatile memory.

Source

fn get_zero_position(&mut self) -> Result<u16, AS56Error<Self::Error>>

Gets the current zero position (ZPOS).

Source

fn set_zero_position( &mut self, angle: u16, ) -> Result<(), AS56Error<Self::Error>>

Sets the zero position (ZPOS) in volatile memory.

Source

fn get_max_position(&mut self) -> Result<u16, AS56Error<Self::Error>>

Gets the current maximum position (MPOS).

Source

fn set_max_position(&mut self, angle: u16) -> Result<(), AS56Error<Self::Error>>

Sets the maximum position (MPOS) in volatile memory.

Source

fn get_max_angle(&mut self) -> Result<u16, AS56Error<Self::Error>>

Gets the current maximum angle (MANG).

Source

fn set_max_angle(&mut self, angle: u16) -> Result<(), AS56Error<Self::Error>>

Sets the maximum angle (MANG) in volatile memory.

Implementors§