embassy-stm32

Crates

git

Versions

stm32h7s7l8

Flavors

embassy_stm32::cordic

Struct Cordic

Source
pub struct Cordic<'d, T: Instance> { /* private fields */ }
Expand description

CORDIC driver

Implementations§

Source§

impl<'d, T: Instance> Cordic<'d, T>

Source

pub fn new(peri: impl Peripheral<P = T> + 'd, config: Config) -> Self

Create a Cordic driver instance

Note:
If you need a peripheral -> CORDIC -> peripheral mode,
you may want to set Cordic into [Mode::ZeroOverhead] mode, and add extra arguments with Self::extra_config

Source

pub fn set_config(&mut self, config: Config)

Set a new config for Cordic driver

Source

pub fn extra_config( &mut self, arg_cnt: AccessCount, arg_width: Width, res_width: Width, )

Set extra config for data count and data width.

Source

pub fn reconfigure(&mut self)

Disable IRQ and DMA, clean RRDY, and set ARG2 to +1 (0x7FFFFFFF)

Source§

impl<'d, T: Instance> Cordic<'d, T>

Source

pub fn blocking_calc_32bit( &mut self, arg: &[u32], res: &mut [u32], arg1_only: bool, res1_only: bool, ) -> Result<usize, CordicError>

Run a blocking CORDIC calculation in q1.31 format

Notice:
If you set arg1_only to true, please be sure ARG2 value has been set to desired value before.
This function won’t set ARG2 to +1 before or after each round of calculation.
If you want to make sure ARG2 is set to +1, consider run .reconfigure().

Source

pub async fn async_calc_32bit( &mut self, write_dma: impl Peripheral<P = impl WriteDma<T>>, read_dma: impl Peripheral<P = impl ReadDma<T>>, arg: &[u32], res: &mut [u32], arg1_only: bool, res1_only: bool, ) -> Result<usize, CordicError>

Run a async CORDIC calculation in q.1.31 format

Notice:
If you set arg1_only to true, please be sure ARG2 value has been set to desired value before.
This function won’t set ARG2 to +1 before or after each round of calculation.
If you want to make sure ARG2 is set to +1, consider run .reconfigure().

Source§

impl<'d, T: Instance> Cordic<'d, T>

Source

pub fn blocking_calc_16bit( &mut self, arg: &[u32], res: &mut [u32], ) -> Result<usize, CordicError>

Run a blocking CORDIC calculation in q1.15 format

Notice::
User will take respond to merge two u16 arguments into one u32 data, and/or split one u32 data into two u16 results.

Source

pub async fn async_calc_16bit( &mut self, write_dma: impl Peripheral<P = impl WriteDma<T>>, read_dma: impl Peripheral<P = impl ReadDma<T>>, arg: &[u32], res: &mut [u32], ) -> Result<usize, CordicError>

Run a async CORDIC calculation in q1.15 format

Notice::
User will take respond to merge two u16 arguments into one u32 data, and/or split one u32 data into two u16 results.

Source§

impl<'d, T: Instance> Cordic<'d, T>

Source

pub fn check_f64_arg1(&self, arg: &f64) -> Result<(), ArgError>

check input value ARG1, SCALE and FUNCTION are compatible with each other

Source

pub fn check_f64_arg2(&self, arg: &f64) -> Result<(), ArgError>

check input value ARG2 and FUNCTION are compatible with each other

Source§

impl<'d, T: Instance> Cordic<'d, T>

Source

pub fn check_f32_arg1(&self, arg: &f32) -> Result<(), ArgError>

check input value ARG1, SCALE and FUNCTION are compatible with each other

Source

pub fn check_f32_arg2(&self, arg: &f32) -> Result<(), ArgError>

check input value ARG2 and FUNCTION are compatible with each other

Trait Implementations§

Source§

impl<'d, T: Instance> Drop for Cordic<'d, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'d, T> Freeze for Cordic<'d, T>
where T: Freeze,

§

impl<'d, T> RefUnwindSafe for Cordic<'d, T>
where T: RefUnwindSafe,

§

impl<'d, T> Send for Cordic<'d, T>
where T: Send,

§

impl<'d, T> Sync for Cordic<'d, T>
where T: Sync,

§

impl<'d, T> Unpin for Cordic<'d, T>
where T: Unpin,

§

impl<'d, T> !UnwindSafe for Cordic<'d, T>

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.