ra6m3/elc/
elsr.rs

1#[doc = "Register `ELSR%s` reader"]
2pub struct R(crate::R<ELSR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ELSR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ELSR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ELSR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ELSR%s` writer"]
17pub struct W(crate::W<ELSR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ELSR_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<ELSR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ELSR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ELS` reader - Event Link Select"]
38pub type ELS_R = crate::FieldReader<u16, ELS_A>;
39#[doc = "Event Link Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u16)]
42pub enum ELS_A {
43    #[doc = "0: Event output to the corresponding peripheral module is disabled."]
44    _0X000 = 0,
45}
46impl From<ELS_A> for u16 {
47    #[inline(always)]
48    fn from(variant: ELS_A) -> Self {
49        variant as _
50    }
51}
52impl ELS_R {
53    #[doc = "Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> Option<ELS_A> {
56        match self.bits {
57            0 => Some(ELS_A::_0X000),
58            _ => None,
59        }
60    }
61    #[doc = "Checks if the value of the field is `_0X000`"]
62    #[inline(always)]
63    pub fn is_0x000(&self) -> bool {
64        *self == ELS_A::_0X000
65    }
66}
67#[doc = "Field `ELS` writer - Event Link Select"]
68pub type ELS_W<'a, const O: u8> = crate::FieldWriter<'a, u16, ELSR_SPEC, u16, ELS_A, 9, O>;
69impl<'a, const O: u8> ELS_W<'a, O> {
70    #[doc = "Event output to the corresponding peripheral module is disabled."]
71    #[inline(always)]
72    pub fn _0x000(self) -> &'a mut W {
73        self.variant(ELS_A::_0X000)
74    }
75}
76impl R {
77    #[doc = "Bits 0:8 - Event Link Select"]
78    #[inline(always)]
79    pub fn els(&self) -> ELS_R {
80        ELS_R::new(self.bits & 0x01ff)
81    }
82}
83impl W {
84    #[doc = "Bits 0:8 - Event Link Select"]
85    #[inline(always)]
86    #[must_use]
87    pub fn els(&mut self) -> ELS_W<0> {
88        ELS_W::new(self)
89    }
90    #[doc = "Writes raw bits to the register."]
91    #[inline(always)]
92    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
93        self.0.bits(bits);
94        self
95    }
96}
97#[doc = "Event Link Setting Register %s\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 [elsr](index.html) module"]
98pub struct ELSR_SPEC;
99impl crate::RegisterSpec for ELSR_SPEC {
100    type Ux = u16;
101}
102#[doc = "`read()` method returns [elsr::R](R) reader structure"]
103impl crate::Readable for ELSR_SPEC {
104    type Reader = R;
105}
106#[doc = "`write(|w| ..)` method takes [elsr::W](W) writer structure"]
107impl crate::Writable for ELSR_SPEC {
108    type Writer = W;
109    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
110    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
111}
112#[doc = "`reset()` method sets ELSR%s to value 0"]
113impl crate::Resettable for ELSR_SPEC {
114    const RESET_VALUE: Self::Ux = 0;
115}