Available on crate feature
unstable only.Expand description
§Coordinate Rotation Digital Computer (CORDIC)
§Overview
The CORDIC peripheral computes trigonometric and hyperbolic functions, square roots, and natural logarithms. It also converts Cartesian vectors to polar coordinates.
The driver uses signed Q1.15 and Q1.31 values in [-1, 1).
Angle formulas use radians.
§Configuration
The default Config uses the 160 MHz PLL without division.
§Implementation State
The driver uses blocking register polling.
§Examples
use esp_hal::{cordic::{ClockSource, Config, Cordic, Precision}, time::Rate};
let config = Config::default()
.with_clock_source(ClockSource::Xtal)
.with_frequency(Rate::from_mhz(24))
.with_precision(Precision::Iterations16);
let mut cordic = Cordic::new(peripherals.CORDIC, config)?;
let (sin, cos) = cordic.sin_cos_q15(0x2000)?; // π/4Structs§
Enums§
- Clock
Source - Source of the CORDIC calculation clock.
- Config
Error - A CORDIC configuration error.
- Error
- An error returned by a CORDIC calculation.
- Precision
- Number of CORDIC iterations per calculation.