Skip to main content

mcxa_pac/mau0/
gexp_status.rs

1#[doc = "Register `GEXP_STATUS` reader"]
2pub type R = crate::R<GexpStatusSpec>;
3#[doc = "Register `GEXP_STATUS` writer"]
4pub type W = crate::W<GexpStatusSpec>;
5#[doc = "Direct operation Error\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Error {
9    #[doc = "0: No error is generated."]
10    NoError = 0,
11    #[doc = "1: An error is generated."]
12    Error = 1,
13}
14impl From<Error> for bool {
15    #[inline(always)]
16    fn from(variant: Error) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `ERROR` reader - Direct operation Error"]
21pub type ErrorR = crate::BitReader<Error>;
22impl ErrorR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Error {
26        match self.bits {
27            false => Error::NoError,
28            true => Error::Error,
29        }
30    }
31    #[doc = "No error is generated."]
32    #[inline(always)]
33    pub fn is_no_error(&self) -> bool {
34        *self == Error::NoError
35    }
36    #[doc = "An error is generated."]
37    #[inline(always)]
38    pub fn is_error(&self) -> bool {
39        *self == Error::Error
40    }
41}
42#[doc = "Field `ERROR` writer - Direct operation Error"]
43pub type ErrorW<'a, REG> = crate::BitWriter<'a, REG, Error>;
44impl<'a, REG> ErrorW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "No error is generated."]
49    #[inline(always)]
50    pub fn no_error(self) -> &'a mut crate::W<REG> {
51        self.variant(Error::NoError)
52    }
53    #[doc = "An error is generated."]
54    #[inline(always)]
55    pub fn error(self) -> &'a mut crate::W<REG> {
56        self.variant(Error::Error)
57    }
58}
59impl R {
60    #[doc = "Bit 0 - Direct operation Error"]
61    #[inline(always)]
62    pub fn error(&self) -> ErrorR {
63        ErrorR::new((self.bits & 1) != 0)
64    }
65}
66#[cfg(feature = "debug")]
67impl core::fmt::Debug for R {
68    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
69        f.debug_struct("GEXP_STATUS").field("error", &self.error()).finish()
70    }
71}
72impl W {
73    #[doc = "Bit 0 - Direct operation Error"]
74    #[inline(always)]
75    pub fn error(&mut self) -> ErrorW<'_, GexpStatusSpec> {
76        ErrorW::new(self, 0)
77    }
78}
79#[doc = "General Exception Status\n\nYou can [`read`](crate::Reg::read) this register and get [`gexp_status::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gexp_status::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct GexpStatusSpec;
81impl crate::RegisterSpec for GexpStatusSpec {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`gexp_status::R`](R) reader structure"]
85impl crate::Readable for GexpStatusSpec {}
86#[doc = "`write(|w| ..)` method takes [`gexp_status::W`](W) writer structure"]
87impl crate::Writable for GexpStatusSpec {
88    type Safety = crate::Unsafe;
89}
90#[doc = "`reset()` method sets GEXP_STATUS to value 0"]
91impl crate::Resettable for GexpStatusSpec {}