Struct ma734::MA734

source ·
pub struct MA734<SPI, CS> { /* private fields */ }
Expand description

Driver for the MA734

Implementations§

source§

impl<SPI, CS> MA734<SPI, CS>where SPI: Transfer<u8>, CS: OutputPin,

source

pub fn new(spi: SPI, cs: CS) -> Self

Initialize the MA734 driver.

source

pub fn release(self) -> (SPI, CS)

Realeses SPI bus and CS pin.

source

pub fn read_angle(&mut self) -> Result<u16, Error<SPI>>

Read current angle.

source

pub fn get_zero_angle(&mut self) -> Result<u16, Error<SPI>>

Get zero position angle

source

pub fn set_zero_angle(&mut self, angle: u16) -> Result<(), Error<SPI>>

Set zero position angle

source

pub fn get_bias_current_trimming( &mut self ) -> Result<BiasCurrentTrimming, Error<SPI>>

Get bias current trimming settings

source

pub fn set_bias_current_trimming( &mut self, bct: BiasCurrentTrimming ) -> Result<(), Error<SPI>>

Set bias current trimming settings

source

pub fn get_angle_change_interrupt( &mut self ) -> Result<AngleChangeInterrupt, Error<SPI>>

Get angle change interrupt config

source

pub fn set_angle_change_interrupt( &mut self, aci: AngleChangeInterrupt ) -> Result<(), Error<SPI>>

Set angle change interrupt config

source

pub fn get_magnetic_thresholds( &mut self ) -> Result<MagneticFieldThresholds, Error<SPI>>

Get magnetic field thresholds

source

pub fn set_magnetic_thresholds( &mut self, mft: MagneticFieldThresholds ) -> Result<(), Error<SPI>>

Set magnetic field thresholds

source

pub fn set_rotation_dir(&mut self, val: Dir) -> Result<(), Error<SPI>>

Set rotation direction

source

pub fn get_rotation_dir(&mut self) -> Result<Dir, Error<SPI>>

Get rotation direction

source

pub fn set_filter_window(&mut self, val: u8) -> Result<(), Error<SPI>>

Set filter window

source

pub fn get_filter_window(&mut self) -> Result<u8, Error<SPI>>

Get filter window

source

pub fn write_register(&mut self, reg: u8, val: u8) -> Result<u8, Error<SPI>>

Write register

source

pub fn read_register(&mut self, reg: u8) -> Result<u8, Error<SPI>>

Read register

source

pub fn store_register_into_nvm(&mut self, reg: u8) -> Result<(), Error<SPI>>

Store Register into the NVM

source

pub fn store_all_registers_into_nvm(&mut self) -> Result<(), Error<SPI>>

Store All Registers into the NVM

source

pub fn restore_all_registers_from_nvm(&mut self) -> Result<(), Error<SPI>>

Restore All Registers from the NVM

source

pub fn get_magnetic_flags(&mut self) -> Result<MagneticFlags, Error<SPI>>

Get magnetic flags

source

pub fn get_error_flags(&mut self) -> Result<ErrorFlags, Error<SPI>>

Get error flags

source

pub fn clear_error_flags(&mut self) -> Result<(), Error<SPI>>

Clear error flags

Trait Implementations§

source§

impl<SPI: Debug, CS: Debug> Debug for MA734<SPI, CS>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<SPI, CS> RefUnwindSafe for MA734<SPI, CS>where CS: RefUnwindSafe, SPI: RefUnwindSafe,

§

impl<SPI, CS> Send for MA734<SPI, CS>where CS: Send, SPI: Send,

§

impl<SPI, CS> Sync for MA734<SPI, CS>where CS: Sync, SPI: Sync,

§

impl<SPI, CS> Unpin for MA734<SPI, CS>where CS: Unpin, SPI: Unpin,

§

impl<SPI, CS> UnwindSafe for MA734<SPI, CS>where CS: UnwindSafe, SPI: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.