msp430fr2355/sys/
sysuniv.rs

1#[doc = "Register `SYSUNIV` reader"]
2pub struct R(crate::R<SYSUNIV_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SYSUNIV_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SYSUNIV_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SYSUNIV_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SYSUNIV` writer"]
17pub struct W(crate::W<SYSUNIV_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SYSUNIV_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<SYSUNIV_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SYSUNIV_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SYSUNIV` reader - User NMI vector"]
38pub type SYSUNIV_R = crate::FieldReader<u16, SYSUNIV_A>;
39#[doc = "User NMI vector\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u16)]
42pub enum SYSUNIV_A {
43    #[doc = "0: No interrupt pending"]
44    NONE = 0,
45    #[doc = "2: NMIIFG NMI pin"]
46    NMIIFG = 2,
47    #[doc = "4: OFIFG oscillator fault"]
48    OFIFG = 4,
49}
50impl From<SYSUNIV_A> for u16 {
51    #[inline(always)]
52    fn from(variant: SYSUNIV_A) -> Self {
53        variant as _
54    }
55}
56impl SYSUNIV_R {
57    #[doc = "Get enumerated values variant"]
58    #[inline(always)]
59    pub fn variant(&self) -> Option<SYSUNIV_A> {
60        match self.bits {
61            0 => Some(SYSUNIV_A::NONE),
62            2 => Some(SYSUNIV_A::NMIIFG),
63            4 => Some(SYSUNIV_A::OFIFG),
64            _ => None,
65        }
66    }
67    #[doc = "Checks if the value of the field is `NONE`"]
68    #[inline(always)]
69    pub fn is_none(&self) -> bool {
70        *self == SYSUNIV_A::NONE
71    }
72    #[doc = "Checks if the value of the field is `NMIIFG`"]
73    #[inline(always)]
74    pub fn is_nmiifg(&self) -> bool {
75        *self == SYSUNIV_A::NMIIFG
76    }
77    #[doc = "Checks if the value of the field is `OFIFG`"]
78    #[inline(always)]
79    pub fn is_ofifg(&self) -> bool {
80        *self == SYSUNIV_A::OFIFG
81    }
82}
83impl R {
84    #[doc = "Bits 0:15 - User NMI vector"]
85    #[inline(always)]
86    pub fn sysuniv(&self) -> SYSUNIV_R {
87        SYSUNIV_R::new(self.bits)
88    }
89}
90impl W {
91    #[doc = "Writes raw bits to the register."]
92    #[inline(always)]
93    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
94        self.0.bits(bits);
95        self
96    }
97}
98#[doc = "User NMI Vector Generator\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 [sysuniv](index.html) module"]
99pub struct SYSUNIV_SPEC;
100impl crate::RegisterSpec for SYSUNIV_SPEC {
101    type Ux = u16;
102}
103#[doc = "`read()` method returns [sysuniv::R](R) reader structure"]
104impl crate::Readable for SYSUNIV_SPEC {
105    type Reader = R;
106}
107#[doc = "`write(|w| ..)` method takes [sysuniv::W](W) writer structure"]
108impl crate::Writable for SYSUNIV_SPEC {
109    type Writer = W;
110}
111#[doc = "`reset()` method sets SYSUNIV to value 0"]
112impl crate::Resettable for SYSUNIV_SPEC {
113    #[inline(always)]
114    fn reset_value() -> Self::Ux {
115        0
116    }
117}