stm32 CORDIC: typo fix

This commit is contained in:
eZio Pan 2024-03-22 00:24:53 +08:00
parent 0d065ab2d6
commit fac4f9aa2f
4 changed files with 13 additions and 13 deletions

View File

@ -25,7 +25,7 @@ pub enum Precision {
Iters16,
Iters20,
#[default]
Iters24, // this value is recomended by Reference Manual
Iters24, // this value is recommended by Reference Manual
Iters28,
Iters32,
Iters36,

View File

@ -45,7 +45,7 @@ impl defmt::Format for CordicError {
}
}
/// Error dring parsing [Cordic::Config](super::Config)
/// Error during parsing [Cordic::Config](super::Config)
#[allow(dead_code)]
#[derive(Debug)]
pub struct ConfigError {

View File

@ -91,8 +91,8 @@ impl<'d, T: Instance> Cordic<'d, T> {
/// Create a Cordic driver instance
///
/// Note:
/// If you need a periperhal -> CORDIC -> peripehral mode,
/// you may want to set Cordic into [Mode::ZeroOverhead] mode, and add extra arguemnts with [Self::extra_config]
/// 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]
pub fn new(peri: impl Peripheral<P = T> + 'd, config: Config) -> Self {
T::enable_and_reset();
@ -123,7 +123,7 @@ impl<'d, T: Instance> Cordic<'d, T> {
self.peri.set_scale(self.config.scale);
// we don't set NRES in here, but to make sure NRES is set each time user call "calc"-ish functions,
// since each "calc"-ish functions can have different ARGSIZE and RESSIZE, thus NRES should be change accrodingly.
// since each "calc"-ish functions can have different ARGSIZE and RESSIZE, thus NRES should be change accordingly.
}
async fn launch_a_dma_transfer(
@ -256,7 +256,7 @@ impl<'d, T: Instance> Cordic<'d, T> {
self.blocking_write_f64(input_left[0])?;
for &arg in input_left.iter().skip(1) {
// this line write arg for next round caculation to cordic,
// this line write arg for next round calculation to cordic,
// and read result from last round
self.blocking_write_f64(arg)?;
self.blocking_read_f64_to_buf(output, &mut output_count);
@ -426,8 +426,8 @@ impl<'d, T: Instance> Cordic<'d, T> {
write_dma: impl Peripheral<P = impl WriteDma<T>>,
read_dma: impl Peripheral<P = impl ReadDma<T>>,
double_input: bool, // gether extra info to calc output_buf size
input_buf: &[u32], // input_buf, its content should be extact values and length for calculation
output: &mut [f64], // caller uses should this as a final output array
input_buf: &[u32], // input_buf, its content should be exact length for calculation
output: &mut [f64], // caller should uses this buf as a final output array
output_start_index: &mut usize, // the index of start point of the output for this round of calculation
) {
// output_buf is the place to store raw value from CORDIC (via DMA).
@ -581,7 +581,7 @@ impl<'d, T: Instance> Cordic<'d, T> {
// In q1.15 mode, we always fill 1 pair of 16bit value into WDATA register.
// If arg2s is None or empty array, we assume arg2 value always 1.0 (as reset value for ARG2).
// If arg2s has some value, and but not as long as arg1s,
// we fill the reset of arg2 values with last value from arg2s (as q1.31 version does)
// we fill the reset of arg2 values with last value from arg2s (as CORDIC behavior on q1.31 format)
let arg2_default_value = match arg2s {
Some(arg2s) if !arg2s.is_empty() => arg2s[arg2s.len() - 1],
@ -624,8 +624,8 @@ impl<'d, T: Instance> Cordic<'d, T> {
&mut self,
write_dma: impl Peripheral<P = impl WriteDma<T>>,
read_dma: impl Peripheral<P = impl ReadDma<T>>,
input_buf: &[u32], // input_buf, its content should be extact values and length for calculation
output: &mut [f32], // caller uses should this as a final output array
input_buf: &[u32], // input_buf, its content should be exact length for calculation
output: &mut [f32], // caller should uses this buf as a final output array
output_start_index: &mut usize, // the index of start point of the output for this round of calculation
) {
// output_buf is the place to store raw value from CORDIC (via DMA).

View File

@ -25,7 +25,7 @@ macro_rules! floating_fixed_convert {
};
// It's necessary to cast the float value to signed integer, before convert it to a unsigned value.
// Since value from register is actually a "signed value", a "as" cast will keep original binary format but mark it as unsgined value.
// Since value from register is actually a "signed value", a "as" cast will keep original binary format but mark it as a unsigned value for register writing.
// see https://doc.rust-lang.org/reference/expressions/operator-expr.html#numeric-cast
Ok((value * ((1 as $unsigned_bin_typ << $offset) as $float_ty)) as $signed_bin_typ as $unsigned_bin_typ)
}
@ -34,7 +34,7 @@ macro_rules! floating_fixed_convert {
/// convert fixed point to float point format
pub fn $q_to_f(value: $unsigned_bin_typ) -> $float_ty {
// It's necessary to cast the unsigned integer to signed integer, before convert it to a float value.
// Since value from register is actually a "signed value", a "as" cast will keep original binary format but mark it as signed value.
// Since value from register is actually a "signed value", a "as" cast will keep original binary format but mark it as a signed value.
// see https://doc.rust-lang.org/reference/expressions/operator-expr.html#numeric-cast
(value as $signed_bin_typ as $float_ty) / ((1 as $unsigned_bin_typ << $offset) as $float_ty)
}