bl808_pac/lz4d/
interrupt_enable.rs

1#[doc = "Register `interrupt_enable` reader"]
2pub struct R(crate::R<INTERRUPT_ENABLE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INTERRUPT_ENABLE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INTERRUPT_ENABLE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INTERRUPT_ENABLE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `interrupt_enable` writer"]
17pub struct W(crate::W<INTERRUPT_ENABLE_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<INTERRUPT_ENABLE_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<INTERRUPT_ENABLE_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<INTERRUPT_ENABLE_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `done` reader - Decompliation finished"]
38pub type DONE_R = crate::BitReader<INTERRUPT_ENABLE_A>;
39#[doc = "Decompliation finished\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum INTERRUPT_ENABLE_A {
42    #[doc = "1: Enable interrupt"]
43    ENABLE = 1,
44    #[doc = "0: Disable interrupt"]
45    DISABLE = 0,
46}
47impl From<INTERRUPT_ENABLE_A> for bool {
48    #[inline(always)]
49    fn from(variant: INTERRUPT_ENABLE_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl DONE_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> INTERRUPT_ENABLE_A {
57        match self.bits {
58            true => INTERRUPT_ENABLE_A::ENABLE,
59            false => INTERRUPT_ENABLE_A::DISABLE,
60        }
61    }
62    #[doc = "Checks if the value of the field is `ENABLE`"]
63    #[inline(always)]
64    pub fn is_enable(&self) -> bool {
65        *self == INTERRUPT_ENABLE_A::ENABLE
66    }
67    #[doc = "Checks if the value of the field is `DISABLE`"]
68    #[inline(always)]
69    pub fn is_disable(&self) -> bool {
70        *self == INTERRUPT_ENABLE_A::DISABLE
71    }
72}
73#[doc = "Field `done` writer - Decompliation finished"]
74pub type DONE_W<'a, const O: u8> =
75    crate::BitWriter<'a, u32, INTERRUPT_ENABLE_SPEC, INTERRUPT_ENABLE_A, O>;
76impl<'a, const O: u8> DONE_W<'a, O> {
77    #[doc = "Enable interrupt"]
78    #[inline(always)]
79    pub fn enable(self) -> &'a mut W {
80        self.variant(INTERRUPT_ENABLE_A::ENABLE)
81    }
82    #[doc = "Disable interrupt"]
83    #[inline(always)]
84    pub fn disable(self) -> &'a mut W {
85        self.variant(INTERRUPT_ENABLE_A::DISABLE)
86    }
87}
88#[doc = "Field `error` reader - Error occurred while decompliation"]
89pub use DONE_R as ERROR_R;
90#[doc = "Field `error` writer - Error occurred while decompliation"]
91pub use DONE_W as ERROR_W;
92impl R {
93    #[doc = "Bit 0 - Decompliation finished"]
94    #[inline(always)]
95    pub fn done(&self) -> DONE_R {
96        DONE_R::new((self.bits & 1) != 0)
97    }
98    #[doc = "Bit 1 - Error occurred while decompliation"]
99    #[inline(always)]
100    pub fn error(&self) -> ERROR_R {
101        ERROR_R::new(((self.bits >> 1) & 1) != 0)
102    }
103}
104impl W {
105    #[doc = "Bit 0 - Decompliation finished"]
106    #[inline(always)]
107    pub fn done(&mut self) -> DONE_W<0> {
108        DONE_W::new(self)
109    }
110    #[doc = "Bit 1 - Error occurred while decompliation"]
111    #[inline(always)]
112    pub fn error(&mut self) -> ERROR_W<1> {
113        ERROR_W::new(self)
114    }
115    #[doc = "Writes raw bits to the register."]
116    #[inline(always)]
117    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
118        self.0.bits(bits);
119        self
120    }
121}
122#[doc = "Interrupt enable register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [interrupt_enable](index.html) module"]
123pub struct INTERRUPT_ENABLE_SPEC;
124impl crate::RegisterSpec for INTERRUPT_ENABLE_SPEC {
125    type Ux = u32;
126}
127#[doc = "`read()` method returns [interrupt_enable::R](R) reader structure"]
128impl crate::Readable for INTERRUPT_ENABLE_SPEC {
129    type Reader = R;
130}
131#[doc = "`write(|w| ..)` method takes [interrupt_enable::W](W) writer structure"]
132impl crate::Writable for INTERRUPT_ENABLE_SPEC {
133    type Writer = W;
134}
135#[doc = "`reset()` method sets interrupt_enable to value 0x03"]
136impl crate::Resettable for INTERRUPT_ENABLE_SPEC {
137    #[inline(always)]
138    fn reset_value() -> Self::Ux {
139        0x03
140    }
141}