Skip to main content

AS5600Driver

Struct AS5600Driver 

Source
pub struct AS5600Driver<I2C> { /* private fields */ }
Expand description

Main driver for the AS5600 sensor.

Implementations§

Source§

impl<I2C: I2c<SevenBitAddress>> AS5600Driver<I2C>

Source

pub fn new(i2c: I2C) -> Self

Creates a new driver instance with the default I2C address (0x36).

Source

pub fn with_address(i2c: I2C, address: u8) -> Self

Creates a new driver instance with a custom I2C address.

Source

pub unsafe fn danger_permanent_burn_settings( &mut self, ) -> Result<(), AS56Error<I2C::Error>>

DANGER: Permanently burns ZPOS and MPOS settings to the chip.

Source

pub unsafe fn danger_permanent_burn_config( &mut self, ) -> Result<(), AS56Error<I2C::Error>>

DANGER: Permanently burns Configuration settings to the chip.

Trait Implementations§

Source§

impl<I2C: I2c<SevenBitAddress>> AS5600Interface for AS5600Driver<I2C>

Source§

type Error = <I2C as ErrorType>::Error

The error type returned by the sensor 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_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_status_raw(&mut self) -> Result<u8, AS56Error<Self::Error>>

Returns the raw value of the status register.
Source§

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

Returns the current magnet status and field strength health.
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_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.

Auto Trait Implementations§

§

impl<I2C> Freeze for AS5600Driver<I2C>
where I2C: Freeze,

§

impl<I2C> RefUnwindSafe for AS5600Driver<I2C>
where I2C: RefUnwindSafe,

§

impl<I2C> Send for AS5600Driver<I2C>
where I2C: Send,

§

impl<I2C> Sync for AS5600Driver<I2C>
where I2C: Sync,

§

impl<I2C> Unpin for AS5600Driver<I2C>
where I2C: Unpin,

§

impl<I2C> UnwindSafe for AS5600Driver<I2C>
where I2C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.