pub type R = crate::R<CSRrs>;
pub type W = crate::W<CSRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FUNC {
Cosine = 0,
Sine = 1,
Phase = 2,
Modulus = 3,
Arctangent = 4,
HyperbolicCosine = 5,
HyperbolicSine = 6,
Arctanh = 7,
NaturalLogarithm = 8,
SquareRoot = 9,
}
impl From<FUNC> for u8 {
#[inline(always)]
fn from(variant: FUNC) -> Self {
variant as _
}
}
impl crate::FieldSpec for FUNC {
type Ux = u8;
}
impl crate::IsEnum for FUNC {}
pub type FUNC_R = crate::FieldReader<FUNC>;
impl FUNC_R {
#[inline(always)]
pub const fn variant(&self) -> Option<FUNC> {
match self.bits {
0 => Some(FUNC::Cosine),
1 => Some(FUNC::Sine),
2 => Some(FUNC::Phase),
3 => Some(FUNC::Modulus),
4 => Some(FUNC::Arctangent),
5 => Some(FUNC::HyperbolicCosine),
6 => Some(FUNC::HyperbolicSine),
7 => Some(FUNC::Arctanh),
8 => Some(FUNC::NaturalLogarithm),
9 => Some(FUNC::SquareRoot),
_ => None,
}
}
#[inline(always)]
pub fn is_cosine(&self) -> bool {
*self == FUNC::Cosine
}
#[inline(always)]
pub fn is_sine(&self) -> bool {
*self == FUNC::Sine
}
#[inline(always)]
pub fn is_phase(&self) -> bool {
*self == FUNC::Phase
}
#[inline(always)]
pub fn is_modulus(&self) -> bool {
*self == FUNC::Modulus
}
#[inline(always)]
pub fn is_arctangent(&self) -> bool {
*self == FUNC::Arctangent
}
#[inline(always)]
pub fn is_hyperbolic_cosine(&self) -> bool {
*self == FUNC::HyperbolicCosine
}
#[inline(always)]
pub fn is_hyperbolic_sine(&self) -> bool {
*self == FUNC::HyperbolicSine
}
#[inline(always)]
pub fn is_arctanh(&self) -> bool {
*self == FUNC::Arctanh
}
#[inline(always)]
pub fn is_natural_logarithm(&self) -> bool {
*self == FUNC::NaturalLogarithm
}
#[inline(always)]
pub fn is_square_root(&self) -> bool {
*self == FUNC::SquareRoot
}
}
pub type FUNC_W<'a, REG> = crate::FieldWriter<'a, REG, 4, FUNC>;
impl<'a, REG> FUNC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn cosine(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::Cosine)
}
#[inline(always)]
pub fn sine(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::Sine)
}
#[inline(always)]
pub fn phase(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::Phase)
}
#[inline(always)]
pub fn modulus(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::Modulus)
}
#[inline(always)]
pub fn arctangent(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::Arctangent)
}
#[inline(always)]
pub fn hyperbolic_cosine(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::HyperbolicCosine)
}
#[inline(always)]
pub fn hyperbolic_sine(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::HyperbolicSine)
}
#[inline(always)]
pub fn arctanh(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::Arctanh)
}
#[inline(always)]
pub fn natural_logarithm(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::NaturalLogarithm)
}
#[inline(always)]
pub fn square_root(self) -> &'a mut crate::W<REG> {
self.variant(FUNC::SquareRoot)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PRECISION {
Iters4 = 1,
Iters8 = 2,
Iters12 = 3,
Iters16 = 4,
Iters20 = 5,
Iters24 = 6,
Iters28 = 7,
Iters32 = 8,
Iters36 = 9,
Iters40 = 10,
Iters44 = 11,
Iters48 = 12,
Iters52 = 13,
Iters56 = 14,
Iters60 = 15,
}
impl From<PRECISION> for u8 {
#[inline(always)]
fn from(variant: PRECISION) -> Self {
variant as _
}
}
impl crate::FieldSpec for PRECISION {
type Ux = u8;
}
impl crate::IsEnum for PRECISION {}
pub type PRECISION_R = crate::FieldReader<PRECISION>;
impl PRECISION_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PRECISION> {
match self.bits {
1 => Some(PRECISION::Iters4),
2 => Some(PRECISION::Iters8),
3 => Some(PRECISION::Iters12),
4 => Some(PRECISION::Iters16),
5 => Some(PRECISION::Iters20),
6 => Some(PRECISION::Iters24),
7 => Some(PRECISION::Iters28),
8 => Some(PRECISION::Iters32),
9 => Some(PRECISION::Iters36),
10 => Some(PRECISION::Iters40),
11 => Some(PRECISION::Iters44),
12 => Some(PRECISION::Iters48),
13 => Some(PRECISION::Iters52),
14 => Some(PRECISION::Iters56),
15 => Some(PRECISION::Iters60),
_ => None,
}
}
#[inline(always)]
pub fn is_iters4(&self) -> bool {
*self == PRECISION::Iters4
}
#[inline(always)]
pub fn is_iters8(&self) -> bool {
*self == PRECISION::Iters8
}
#[inline(always)]
pub fn is_iters12(&self) -> bool {
*self == PRECISION::Iters12
}
#[inline(always)]
pub fn is_iters16(&self) -> bool {
*self == PRECISION::Iters16
}
#[inline(always)]
pub fn is_iters20(&self) -> bool {
*self == PRECISION::Iters20
}
#[inline(always)]
pub fn is_iters24(&self) -> bool {
*self == PRECISION::Iters24
}
#[inline(always)]
pub fn is_iters28(&self) -> bool {
*self == PRECISION::Iters28
}
#[inline(always)]
pub fn is_iters32(&self) -> bool {
*self == PRECISION::Iters32
}
#[inline(always)]
pub fn is_iters36(&self) -> bool {
*self == PRECISION::Iters36
}
#[inline(always)]
pub fn is_iters40(&self) -> bool {
*self == PRECISION::Iters40
}
#[inline(always)]
pub fn is_iters44(&self) -> bool {
*self == PRECISION::Iters44
}
#[inline(always)]
pub fn is_iters48(&self) -> bool {
*self == PRECISION::Iters48
}
#[inline(always)]
pub fn is_iters52(&self) -> bool {
*self == PRECISION::Iters52
}
#[inline(always)]
pub fn is_iters56(&self) -> bool {
*self == PRECISION::Iters56
}
#[inline(always)]
pub fn is_iters60(&self) -> bool {
*self == PRECISION::Iters60
}
}
pub type PRECISION_W<'a, REG> = crate::FieldWriter<'a, REG, 4, PRECISION>;
impl<'a, REG> PRECISION_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn iters4(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters4)
}
#[inline(always)]
pub fn iters8(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters8)
}
#[inline(always)]
pub fn iters12(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters12)
}
#[inline(always)]
pub fn iters16(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters16)
}
#[inline(always)]
pub fn iters20(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters20)
}
#[inline(always)]
pub fn iters24(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters24)
}
#[inline(always)]
pub fn iters28(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters28)
}
#[inline(always)]
pub fn iters32(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters32)
}
#[inline(always)]
pub fn iters36(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters36)
}
#[inline(always)]
pub fn iters40(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters40)
}
#[inline(always)]
pub fn iters44(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters44)
}
#[inline(always)]
pub fn iters48(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters48)
}
#[inline(always)]
pub fn iters52(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters52)
}
#[inline(always)]
pub fn iters56(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters56)
}
#[inline(always)]
pub fn iters60(self) -> &'a mut crate::W<REG> {
self.variant(PRECISION::Iters60)
}
}
pub type SCALE_R = crate::FieldReader;
pub type SCALE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum IEN {
Disabled = 0,
Enabled = 1,
}
impl From<IEN> for bool {
#[inline(always)]
fn from(variant: IEN) -> Self {
variant as u8 != 0
}
}
pub type IEN_R = crate::BitReader<IEN>;
impl IEN_R {
#[inline(always)]
pub const fn variant(&self) -> IEN {
match self.bits {
false => IEN::Disabled,
true => IEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == IEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == IEN::Enabled
}
}
pub type IEN_W<'a, REG> = crate::BitWriter<'a, REG, IEN>;
impl<'a, REG> IEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(IEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(IEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAREN {
Disabled = 0,
Enabled = 1,
}
impl From<DMAREN> for bool {
#[inline(always)]
fn from(variant: DMAREN) -> Self {
variant as u8 != 0
}
}
pub type DMAREN_R = crate::BitReader<DMAREN>;
impl DMAREN_R {
#[inline(always)]
pub const fn variant(&self) -> DMAREN {
match self.bits {
false => DMAREN::Disabled,
true => DMAREN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMAREN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMAREN::Enabled
}
}
pub type DMAREN_W<'a, REG> = crate::BitWriter<'a, REG, DMAREN>;
impl<'a, REG> DMAREN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAREN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAREN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAWEN {
Disabled = 0,
Enabled = 1,
}
impl From<DMAWEN> for bool {
#[inline(always)]
fn from(variant: DMAWEN) -> Self {
variant as u8 != 0
}
}
pub type DMAWEN_R = crate::BitReader<DMAWEN>;
impl DMAWEN_R {
#[inline(always)]
pub const fn variant(&self) -> DMAWEN {
match self.bits {
false => DMAWEN::Disabled,
true => DMAWEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMAWEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMAWEN::Enabled
}
}
pub type DMAWEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAWEN>;
impl<'a, REG> DMAWEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAWEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAWEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NRES {
Num1 = 0,
Num2 = 1,
}
impl From<NRES> for bool {
#[inline(always)]
fn from(variant: NRES) -> Self {
variant as u8 != 0
}
}
pub type NRES_R = crate::BitReader<NRES>;
impl NRES_R {
#[inline(always)]
pub const fn variant(&self) -> NRES {
match self.bits {
false => NRES::Num1,
true => NRES::Num2,
}
}
#[inline(always)]
pub fn is_num1(&self) -> bool {
*self == NRES::Num1
}
#[inline(always)]
pub fn is_num2(&self) -> bool {
*self == NRES::Num2
}
}
pub type NRES_W<'a, REG> = crate::BitWriter<'a, REG, NRES>;
impl<'a, REG> NRES_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn num1(self) -> &'a mut crate::W<REG> {
self.variant(NRES::Num1)
}
#[inline(always)]
pub fn num2(self) -> &'a mut crate::W<REG> {
self.variant(NRES::Num2)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NARGS {
Num1 = 0,
Num2 = 1,
}
impl From<NARGS> for bool {
#[inline(always)]
fn from(variant: NARGS) -> Self {
variant as u8 != 0
}
}
pub type NARGS_R = crate::BitReader<NARGS>;
impl NARGS_R {
#[inline(always)]
pub const fn variant(&self) -> NARGS {
match self.bits {
false => NARGS::Num1,
true => NARGS::Num2,
}
}
#[inline(always)]
pub fn is_num1(&self) -> bool {
*self == NARGS::Num1
}
#[inline(always)]
pub fn is_num2(&self) -> bool {
*self == NARGS::Num2
}
}
pub type NARGS_W<'a, REG> = crate::BitWriter<'a, REG, NARGS>;
impl<'a, REG> NARGS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn num1(self) -> &'a mut crate::W<REG> {
self.variant(NARGS::Num1)
}
#[inline(always)]
pub fn num2(self) -> &'a mut crate::W<REG> {
self.variant(NARGS::Num2)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RESSIZE {
Bits32 = 0,
Bits16 = 1,
}
impl From<RESSIZE> for bool {
#[inline(always)]
fn from(variant: RESSIZE) -> Self {
variant as u8 != 0
}
}
pub type RESSIZE_R = crate::BitReader<RESSIZE>;
impl RESSIZE_R {
#[inline(always)]
pub const fn variant(&self) -> RESSIZE {
match self.bits {
false => RESSIZE::Bits32,
true => RESSIZE::Bits16,
}
}
#[inline(always)]
pub fn is_bits32(&self) -> bool {
*self == RESSIZE::Bits32
}
#[inline(always)]
pub fn is_bits16(&self) -> bool {
*self == RESSIZE::Bits16
}
}
pub type RESSIZE_W<'a, REG> = crate::BitWriter<'a, REG, RESSIZE>;
impl<'a, REG> RESSIZE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn bits32(self) -> &'a mut crate::W<REG> {
self.variant(RESSIZE::Bits32)
}
#[inline(always)]
pub fn bits16(self) -> &'a mut crate::W<REG> {
self.variant(RESSIZE::Bits16)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ARGSIZE {
Bits32 = 0,
Bits16 = 1,
}
impl From<ARGSIZE> for bool {
#[inline(always)]
fn from(variant: ARGSIZE) -> Self {
variant as u8 != 0
}
}
pub type ARGSIZE_R = crate::BitReader<ARGSIZE>;
impl ARGSIZE_R {
#[inline(always)]
pub const fn variant(&self) -> ARGSIZE {
match self.bits {
false => ARGSIZE::Bits32,
true => ARGSIZE::Bits16,
}
}
#[inline(always)]
pub fn is_bits32(&self) -> bool {
*self == ARGSIZE::Bits32
}
#[inline(always)]
pub fn is_bits16(&self) -> bool {
*self == ARGSIZE::Bits16
}
}
pub type ARGSIZE_W<'a, REG> = crate::BitWriter<'a, REG, ARGSIZE>;
impl<'a, REG> ARGSIZE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn bits32(self) -> &'a mut crate::W<REG> {
self.variant(ARGSIZE::Bits32)
}
#[inline(always)]
pub fn bits16(self) -> &'a mut crate::W<REG> {
self.variant(ARGSIZE::Bits16)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RRDYR {
NotReady = 0,
Ready = 1,
}
impl From<RRDYR> for bool {
#[inline(always)]
fn from(variant: RRDYR) -> Self {
variant as u8 != 0
}
}
pub type RRDY_R = crate::BitReader<RRDYR>;
impl RRDY_R {
#[inline(always)]
pub const fn variant(&self) -> RRDYR {
match self.bits {
false => RRDYR::NotReady,
true => RRDYR::Ready,
}
}
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == RRDYR::NotReady
}
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == RRDYR::Ready
}
}
impl R {
#[inline(always)]
pub fn func(&self) -> FUNC_R {
FUNC_R::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn precision(&self) -> PRECISION_R {
PRECISION_R::new(((self.bits >> 4) & 0x0f) as u8)
}
#[inline(always)]
pub fn scale(&self) -> SCALE_R {
SCALE_R::new(((self.bits >> 8) & 7) as u8)
}
#[inline(always)]
pub fn ien(&self) -> IEN_R {
IEN_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn dmaren(&self) -> DMAREN_R {
DMAREN_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn dmawen(&self) -> DMAWEN_R {
DMAWEN_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn nres(&self) -> NRES_R {
NRES_R::new(((self.bits >> 19) & 1) != 0)
}
#[inline(always)]
pub fn nargs(&self) -> NARGS_R {
NARGS_R::new(((self.bits >> 20) & 1) != 0)
}
#[inline(always)]
pub fn ressize(&self) -> RESSIZE_R {
RESSIZE_R::new(((self.bits >> 21) & 1) != 0)
}
#[inline(always)]
pub fn argsize(&self) -> ARGSIZE_R {
ARGSIZE_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn rrdy(&self) -> RRDY_R {
RRDY_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CSR")
.field("func", &self.func())
.field("precision", &self.precision())
.field("scale", &self.scale())
.field("ien", &self.ien())
.field("dmaren", &self.dmaren())
.field("dmawen", &self.dmawen())
.field("nres", &self.nres())
.field("nargs", &self.nargs())
.field("ressize", &self.ressize())
.field("argsize", &self.argsize())
.field("rrdy", &self.rrdy())
.finish()
}
}
impl W {
#[inline(always)]
pub fn func(&mut self) -> FUNC_W<CSRrs> {
FUNC_W::new(self, 0)
}
#[inline(always)]
pub fn precision(&mut self) -> PRECISION_W<CSRrs> {
PRECISION_W::new(self, 4)
}
#[inline(always)]
pub fn scale(&mut self) -> SCALE_W<CSRrs> {
SCALE_W::new(self, 8)
}
#[inline(always)]
pub fn ien(&mut self) -> IEN_W<CSRrs> {
IEN_W::new(self, 16)
}
#[inline(always)]
pub fn dmaren(&mut self) -> DMAREN_W<CSRrs> {
DMAREN_W::new(self, 17)
}
#[inline(always)]
pub fn dmawen(&mut self) -> DMAWEN_W<CSRrs> {
DMAWEN_W::new(self, 18)
}
#[inline(always)]
pub fn nres(&mut self) -> NRES_W<CSRrs> {
NRES_W::new(self, 19)
}
#[inline(always)]
pub fn nargs(&mut self) -> NARGS_W<CSRrs> {
NARGS_W::new(self, 20)
}
#[inline(always)]
pub fn ressize(&mut self) -> RESSIZE_W<CSRrs> {
RESSIZE_W::new(self, 21)
}
#[inline(always)]
pub fn argsize(&mut self) -> ARGSIZE_W<CSRrs> {
ARGSIZE_W::new(self, 22)
}
}
pub struct CSRrs;
impl crate::RegisterSpec for CSRrs {
type Ux = u32;
}
impl crate::Readable for CSRrs {}
impl crate::Writable for CSRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CSRrs {
const RESET_VALUE: u32 = 0x50;
}