1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#[doc = "Reader of register STAT"]
pub type R = crate::R<u32, super::STAT>;
#[doc = "Writer for register STAT"]
pub type W = crate::W<u32, super::STAT>;
#[doc = "Register STAT `reset()`'s with value 0x1000_0000"]
impl crate::ResetValue for super::STAT {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0x1000_0000
    }
}
#[doc = "Reader of field `IRQ`"]
pub type IRQ_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `IRQ`"]
pub struct IRQ_W<'a> {
    w: &'a mut W,
}
impl<'a> IRQ_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
        self.w
    }
}
#[doc = "Indicates which channels are ready to proceed with a transfer (the active channel is also included)\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum READY_CHANNELS_A {
    #[doc = "1: CH0"]
    CH0 = 1,
    #[doc = "2: CH1"]
    CH1 = 2,
    #[doc = "4: CH2"]
    CH2 = 4,
    #[doc = "8: CH3"]
    CH3 = 8,
}
impl From<READY_CHANNELS_A> for u8 {
    #[inline(always)]
    fn from(variant: READY_CHANNELS_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `READY_CHANNELS`"]
pub type READY_CHANNELS_R = crate::R<u8, READY_CHANNELS_A>;
impl READY_CHANNELS_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, READY_CHANNELS_A> {
        use crate::Variant::*;
        match self.bits {
            1 => Val(READY_CHANNELS_A::CH0),
            2 => Val(READY_CHANNELS_A::CH1),
            4 => Val(READY_CHANNELS_A::CH2),
            8 => Val(READY_CHANNELS_A::CH3),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `CH0`"]
    #[inline(always)]
    pub fn is_ch0(&self) -> bool {
        *self == READY_CHANNELS_A::CH0
    }
    #[doc = "Checks if the value of the field is `CH1`"]
    #[inline(always)]
    pub fn is_ch1(&self) -> bool {
        *self == READY_CHANNELS_A::CH1
    }
    #[doc = "Checks if the value of the field is `CH2`"]
    #[inline(always)]
    pub fn is_ch2(&self) -> bool {
        *self == READY_CHANNELS_A::CH2
    }
    #[doc = "Checks if the value of the field is `CH3`"]
    #[inline(always)]
    pub fn is_ch3(&self) -> bool {
        *self == READY_CHANNELS_A::CH3
    }
}
#[doc = "Current (active) channel (encoded)\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CUR_CHANNEL_A {
    #[doc = "0: None"]
    NONE = 0,
    #[doc = "1: CH0"]
    CH0 = 1,
    #[doc = "2: CH1"]
    CH1 = 2,
    #[doc = "3: CH2"]
    CH2 = 3,
    #[doc = "4: CH3"]
    CH3 = 4,
}
impl From<CUR_CHANNEL_A> for u8 {
    #[inline(always)]
    fn from(variant: CUR_CHANNEL_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `CUR_CHANNEL`"]
pub type CUR_CHANNEL_R = crate::R<u8, CUR_CHANNEL_A>;
impl CUR_CHANNEL_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, CUR_CHANNEL_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(CUR_CHANNEL_A::NONE),
            1 => Val(CUR_CHANNEL_A::CH0),
            2 => Val(CUR_CHANNEL_A::CH1),
            3 => Val(CUR_CHANNEL_A::CH2),
            4 => Val(CUR_CHANNEL_A::CH3),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `NONE`"]
    #[inline(always)]
    pub fn is_none(&self) -> bool {
        *self == CUR_CHANNEL_A::NONE
    }
    #[doc = "Checks if the value of the field is `CH0`"]
    #[inline(always)]
    pub fn is_ch0(&self) -> bool {
        *self == CUR_CHANNEL_A::CH0
    }
    #[doc = "Checks if the value of the field is `CH1`"]
    #[inline(always)]
    pub fn is_ch1(&self) -> bool {
        *self == CUR_CHANNEL_A::CH1
    }
    #[doc = "Checks if the value of the field is `CH2`"]
    #[inline(always)]
    pub fn is_ch2(&self) -> bool {
        *self == CUR_CHANNEL_A::CH2
    }
    #[doc = "Checks if the value of the field is `CH3`"]
    #[inline(always)]
    pub fn is_ch3(&self) -> bool {
        *self == CUR_CHANNEL_A::CH3
    }
}
#[doc = "Reader of field `OTP_KEY_READY`"]
pub type OTP_KEY_READY_R = crate::R<bool, bool>;
impl R {
    #[doc = "Bits 0:3 - Indicates which channels have pending interrupt requests"]
    #[inline(always)]
    pub fn irq(&self) -> IRQ_R {
        IRQ_R::new((self.bits & 0x0f) as u8)
    }
    #[doc = "Bits 16:23 - Indicates which channels are ready to proceed with a transfer (the active channel is also included)"]
    #[inline(always)]
    pub fn ready_channels(&self) -> READY_CHANNELS_R {
        READY_CHANNELS_R::new(((self.bits >> 16) & 0xff) as u8)
    }
    #[doc = "Bits 24:27 - Current (active) channel (encoded)"]
    #[inline(always)]
    pub fn cur_channel(&self) -> CUR_CHANNEL_R {
        CUR_CHANNEL_R::new(((self.bits >> 24) & 0x0f) as u8)
    }
    #[doc = "Bit 28 - When set, it indicates that the OTP key is shifted from the fuse block and is ready for use."]
    #[inline(always)]
    pub fn otp_key_ready(&self) -> OTP_KEY_READY_R {
        OTP_KEY_READY_R::new(((self.bits >> 28) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:3 - Indicates which channels have pending interrupt requests"]
    #[inline(always)]
    pub fn irq(&mut self) -> IRQ_W {
        IRQ_W { w: self }
    }
}