nrf52811_pac/timer0/
events_compare.rs

1#[doc = "Register `EVENTS_COMPARE[%s]` reader"]
2pub struct R(crate::R<EVENTS_COMPARE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EVENTS_COMPARE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EVENTS_COMPARE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EVENTS_COMPARE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EVENTS_COMPARE[%s]` writer"]
17pub struct W(crate::W<EVENTS_COMPARE_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EVENTS_COMPARE_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<EVENTS_COMPARE_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EVENTS_COMPARE_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EVENTS_COMPARE` reader - Compare event on CC\\[n\\]
38match"]
39pub type EVENTS_COMPARE_R = crate::BitReader<EVENTS_COMPARE_A>;
40#[doc = "Compare event on CC\\[n\\]
41match\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43pub enum EVENTS_COMPARE_A {
44    #[doc = "0: Event not generated"]
45    NOT_GENERATED = 0,
46    #[doc = "1: Event generated"]
47    GENERATED = 1,
48}
49impl From<EVENTS_COMPARE_A> for bool {
50    #[inline(always)]
51    fn from(variant: EVENTS_COMPARE_A) -> Self {
52        variant as u8 != 0
53    }
54}
55impl EVENTS_COMPARE_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub fn variant(&self) -> EVENTS_COMPARE_A {
59        match self.bits {
60            false => EVENTS_COMPARE_A::NOT_GENERATED,
61            true => EVENTS_COMPARE_A::GENERATED,
62        }
63    }
64    #[doc = "Checks if the value of the field is `NOT_GENERATED`"]
65    #[inline(always)]
66    pub fn is_not_generated(&self) -> bool {
67        *self == EVENTS_COMPARE_A::NOT_GENERATED
68    }
69    #[doc = "Checks if the value of the field is `GENERATED`"]
70    #[inline(always)]
71    pub fn is_generated(&self) -> bool {
72        *self == EVENTS_COMPARE_A::GENERATED
73    }
74}
75#[doc = "Field `EVENTS_COMPARE` writer - Compare event on CC\\[n\\]
76match"]
77pub type EVENTS_COMPARE_W<'a, const O: u8> =
78    crate::BitWriter<'a, u32, EVENTS_COMPARE_SPEC, EVENTS_COMPARE_A, O>;
79impl<'a, const O: u8> EVENTS_COMPARE_W<'a, O> {
80    #[doc = "Event not generated"]
81    #[inline(always)]
82    pub fn not_generated(self) -> &'a mut W {
83        self.variant(EVENTS_COMPARE_A::NOT_GENERATED)
84    }
85    #[doc = "Event generated"]
86    #[inline(always)]
87    pub fn generated(self) -> &'a mut W {
88        self.variant(EVENTS_COMPARE_A::GENERATED)
89    }
90}
91impl R {
92    #[doc = "Bit 0 - Compare event on CC\\[n\\]
93match"]
94    #[inline(always)]
95    pub fn events_compare(&self) -> EVENTS_COMPARE_R {
96        EVENTS_COMPARE_R::new((self.bits & 1) != 0)
97    }
98}
99impl W {
100    #[doc = "Bit 0 - Compare event on CC\\[n\\]
101match"]
102    #[inline(always)]
103    pub fn events_compare(&mut self) -> EVENTS_COMPARE_W<0> {
104        EVENTS_COMPARE_W::new(self)
105    }
106    #[doc = "Writes raw bits to the register."]
107    #[inline(always)]
108    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
109        self.0.bits(bits);
110        self
111    }
112}
113#[doc = "Description collection: Compare event on CC\\[n\\]
114match\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 [events_compare](index.html) module"]
115pub struct EVENTS_COMPARE_SPEC;
116impl crate::RegisterSpec for EVENTS_COMPARE_SPEC {
117    type Ux = u32;
118}
119#[doc = "`read()` method returns [events_compare::R](R) reader structure"]
120impl crate::Readable for EVENTS_COMPARE_SPEC {
121    type Reader = R;
122}
123#[doc = "`write(|w| ..)` method takes [events_compare::W](W) writer structure"]
124impl crate::Writable for EVENTS_COMPARE_SPEC {
125    type Writer = W;
126}
127#[doc = "`reset()` method sets EVENTS_COMPARE[%s]
128to value 0"]
129impl crate::Resettable for EVENTS_COMPARE_SPEC {
130    #[inline(always)]
131    fn reset_value() -> Self::Ux {
132        0
133    }
134}