msp430fr2355/tb0/
tb0iv.rs

1#[doc = "Register `TB0IV` reader"]
2pub struct R(crate::R<TB0IV_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TB0IV_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TB0IV_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TB0IV_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TB0IV` writer"]
17pub struct W(crate::W<TB0IV_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TB0IV_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<TB0IV_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TB0IV_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TBIV` reader - Timer_B interrupt vector value"]
38pub type TBIV_R = crate::FieldReader<u16, TBIV_A>;
39#[doc = "Timer_B interrupt vector value\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u16)]
42pub enum TBIV_A {
43    #[doc = "0: No interrupt pending"]
44    NONE = 0,
45    #[doc = "2: Interrupt Source: Capture/compare 1; Interrupt Flag: TBxCCR1 CCIFG; Interrupt Priority: Highest"]
46    TBCCR1 = 2,
47    #[doc = "4: Interrupt Source: Capture/compare 2; Interrupt Flag: TBxCCR2 CCIFG"]
48    TBCCR2 = 4,
49    #[doc = "6: Interrupt Source: Capture/compare 3; Interrupt Flag: TBxCCR3 CCIFG"]
50    TBCCR3 = 6,
51    #[doc = "8: Interrupt Source: Capture/compare 4; Interrupt Flag: TBxCCR4 CCIFG"]
52    TBCCR4 = 8,
53    #[doc = "10: Interrupt Source: Capture/compare 5; Interrupt Flag: TBxCCR5 CCIFG"]
54    TBCCR5 = 10,
55    #[doc = "12: Interrupt Source: Capture/compare 6; Interrupt Flag: TBxCCR6 CCIFG"]
56    TBCCR6 = 12,
57    #[doc = "14: Interrupt Source: Timer overflow; Interrupt Flag: TBxCTL TBIFG; Interrupt Priority: Lowest"]
58    TBIFG = 14,
59}
60impl From<TBIV_A> for u16 {
61    #[inline(always)]
62    fn from(variant: TBIV_A) -> Self {
63        variant as _
64    }
65}
66impl TBIV_R {
67    #[doc = "Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> Option<TBIV_A> {
70        match self.bits {
71            0 => Some(TBIV_A::NONE),
72            2 => Some(TBIV_A::TBCCR1),
73            4 => Some(TBIV_A::TBCCR2),
74            6 => Some(TBIV_A::TBCCR3),
75            8 => Some(TBIV_A::TBCCR4),
76            10 => Some(TBIV_A::TBCCR5),
77            12 => Some(TBIV_A::TBCCR6),
78            14 => Some(TBIV_A::TBIFG),
79            _ => None,
80        }
81    }
82    #[doc = "Checks if the value of the field is `NONE`"]
83    #[inline(always)]
84    pub fn is_none(&self) -> bool {
85        *self == TBIV_A::NONE
86    }
87    #[doc = "Checks if the value of the field is `TBCCR1`"]
88    #[inline(always)]
89    pub fn is_tbccr1(&self) -> bool {
90        *self == TBIV_A::TBCCR1
91    }
92    #[doc = "Checks if the value of the field is `TBCCR2`"]
93    #[inline(always)]
94    pub fn is_tbccr2(&self) -> bool {
95        *self == TBIV_A::TBCCR2
96    }
97    #[doc = "Checks if the value of the field is `TBCCR3`"]
98    #[inline(always)]
99    pub fn is_tbccr3(&self) -> bool {
100        *self == TBIV_A::TBCCR3
101    }
102    #[doc = "Checks if the value of the field is `TBCCR4`"]
103    #[inline(always)]
104    pub fn is_tbccr4(&self) -> bool {
105        *self == TBIV_A::TBCCR4
106    }
107    #[doc = "Checks if the value of the field is `TBCCR5`"]
108    #[inline(always)]
109    pub fn is_tbccr5(&self) -> bool {
110        *self == TBIV_A::TBCCR5
111    }
112    #[doc = "Checks if the value of the field is `TBCCR6`"]
113    #[inline(always)]
114    pub fn is_tbccr6(&self) -> bool {
115        *self == TBIV_A::TBCCR6
116    }
117    #[doc = "Checks if the value of the field is `TBIFG`"]
118    #[inline(always)]
119    pub fn is_tbifg(&self) -> bool {
120        *self == TBIV_A::TBIFG
121    }
122}
123impl R {
124    #[doc = "Bits 0:15 - Timer_B interrupt vector value"]
125    #[inline(always)]
126    pub fn tbiv(&self) -> TBIV_R {
127        TBIV_R::new(self.bits)
128    }
129}
130impl W {
131    #[doc = "Writes raw bits to the register."]
132    #[inline(always)]
133    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
134        self.0.bits(bits);
135        self
136    }
137}
138#[doc = "Timer_Bx Interrupt Vector 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 [tb0iv](index.html) module"]
139pub struct TB0IV_SPEC;
140impl crate::RegisterSpec for TB0IV_SPEC {
141    type Ux = u16;
142}
143#[doc = "`read()` method returns [tb0iv::R](R) reader structure"]
144impl crate::Readable for TB0IV_SPEC {
145    type Reader = R;
146}
147#[doc = "`write(|w| ..)` method takes [tb0iv::W](W) writer structure"]
148impl crate::Writable for TB0IV_SPEC {
149    type Writer = W;
150}
151#[doc = "`reset()` method sets TB0IV to value 0"]
152impl crate::Resettable for TB0IV_SPEC {
153    #[inline(always)]
154    fn reset_value() -> Self::Ux {
155        0
156    }
157}