Skip to main content

atsamd11c14a/nvmctrl/
status.rs

1#[doc = "Reader of register STATUS"]
2pub type R = crate::R<u16, super::STATUS>;
3#[doc = "Writer for register STATUS"]
4pub type W = crate::W<u16, super::STATUS>;
5#[doc = "Register STATUS `reset()`'s with value 0"]
6impl crate::ResetValue for super::STATUS {
7    type Type = u16;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `PRM`"]
14pub type PRM_R = crate::R<bool, bool>;
15#[doc = "Reader of field `LOAD`"]
16pub type LOAD_R = crate::R<bool, bool>;
17#[doc = "Write proxy for field `LOAD`"]
18pub struct LOAD_W<'a> {
19    w: &'a mut W,
20}
21impl<'a> LOAD_W<'a> {
22    #[doc = r"Sets the field bit"]
23    #[inline(always)]
24    pub fn set_bit(self) -> &'a mut W {
25        self.bit(true)
26    }
27    #[doc = r"Clears the field bit"]
28    #[inline(always)]
29    pub fn clear_bit(self) -> &'a mut W {
30        self.bit(false)
31    }
32    #[doc = r"Writes raw bits to the field"]
33    #[inline(always)]
34    pub fn bit(self, value: bool) -> &'a mut W {
35        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u16) & 0x01) << 1);
36        self.w
37    }
38}
39#[doc = "Reader of field `PROGE`"]
40pub type PROGE_R = crate::R<bool, bool>;
41#[doc = "Write proxy for field `PROGE`"]
42pub struct PROGE_W<'a> {
43    w: &'a mut W,
44}
45impl<'a> PROGE_W<'a> {
46    #[doc = r"Sets the field bit"]
47    #[inline(always)]
48    pub fn set_bit(self) -> &'a mut W {
49        self.bit(true)
50    }
51    #[doc = r"Clears the field bit"]
52    #[inline(always)]
53    pub fn clear_bit(self) -> &'a mut W {
54        self.bit(false)
55    }
56    #[doc = r"Writes raw bits to the field"]
57    #[inline(always)]
58    pub fn bit(self, value: bool) -> &'a mut W {
59        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u16) & 0x01) << 2);
60        self.w
61    }
62}
63#[doc = "Reader of field `LOCKE`"]
64pub type LOCKE_R = crate::R<bool, bool>;
65#[doc = "Write proxy for field `LOCKE`"]
66pub struct LOCKE_W<'a> {
67    w: &'a mut W,
68}
69impl<'a> LOCKE_W<'a> {
70    #[doc = r"Sets the field bit"]
71    #[inline(always)]
72    pub fn set_bit(self) -> &'a mut W {
73        self.bit(true)
74    }
75    #[doc = r"Clears the field bit"]
76    #[inline(always)]
77    pub fn clear_bit(self) -> &'a mut W {
78        self.bit(false)
79    }
80    #[doc = r"Writes raw bits to the field"]
81    #[inline(always)]
82    pub fn bit(self, value: bool) -> &'a mut W {
83        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u16) & 0x01) << 3);
84        self.w
85    }
86}
87#[doc = "Reader of field `NVME`"]
88pub type NVME_R = crate::R<bool, bool>;
89#[doc = "Write proxy for field `NVME`"]
90pub struct NVME_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> NVME_W<'a> {
94    #[doc = r"Sets the field bit"]
95    #[inline(always)]
96    pub fn set_bit(self) -> &'a mut W {
97        self.bit(true)
98    }
99    #[doc = r"Clears the field bit"]
100    #[inline(always)]
101    pub fn clear_bit(self) -> &'a mut W {
102        self.bit(false)
103    }
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub fn bit(self, value: bool) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u16) & 0x01) << 4);
108        self.w
109    }
110}
111#[doc = "Reader of field `SB`"]
112pub type SB_R = crate::R<bool, bool>;
113impl R {
114    #[doc = "Bit 0 - Power Reduction Mode"]
115    #[inline(always)]
116    pub fn prm(&self) -> PRM_R {
117        PRM_R::new((self.bits & 0x01) != 0)
118    }
119    #[doc = "Bit 1 - NVM Page Buffer Active Loading"]
120    #[inline(always)]
121    pub fn load(&self) -> LOAD_R {
122        LOAD_R::new(((self.bits >> 1) & 0x01) != 0)
123    }
124    #[doc = "Bit 2 - Programming Error Status"]
125    #[inline(always)]
126    pub fn proge(&self) -> PROGE_R {
127        PROGE_R::new(((self.bits >> 2) & 0x01) != 0)
128    }
129    #[doc = "Bit 3 - Lock Error Status"]
130    #[inline(always)]
131    pub fn locke(&self) -> LOCKE_R {
132        LOCKE_R::new(((self.bits >> 3) & 0x01) != 0)
133    }
134    #[doc = "Bit 4 - NVM Error"]
135    #[inline(always)]
136    pub fn nvme(&self) -> NVME_R {
137        NVME_R::new(((self.bits >> 4) & 0x01) != 0)
138    }
139    #[doc = "Bit 8 - Security Bit Status"]
140    #[inline(always)]
141    pub fn sb(&self) -> SB_R {
142        SB_R::new(((self.bits >> 8) & 0x01) != 0)
143    }
144}
145impl W {
146    #[doc = "Bit 1 - NVM Page Buffer Active Loading"]
147    #[inline(always)]
148    pub fn load(&mut self) -> LOAD_W {
149        LOAD_W { w: self }
150    }
151    #[doc = "Bit 2 - Programming Error Status"]
152    #[inline(always)]
153    pub fn proge(&mut self) -> PROGE_W {
154        PROGE_W { w: self }
155    }
156    #[doc = "Bit 3 - Lock Error Status"]
157    #[inline(always)]
158    pub fn locke(&mut self) -> LOCKE_W {
159        LOCKE_W { w: self }
160    }
161    #[doc = "Bit 4 - NVM Error"]
162    #[inline(always)]
163    pub fn nvme(&mut self) -> NVME_W {
164        NVME_W { w: self }
165    }
166}