Embassy
embassy-stm32

Crates

git

Versions

stm32g431c8

Flavors

Struct embassy_stm32::cordic::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>,

§

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>,

§

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.