atsamd21j18a/evsys/
user.rs1#[doc = "Reader of register USER"]
2pub type R = crate::R<u16, super::USER>;
3#[doc = "Writer for register USER"]
4pub type W = crate::W<u16, super::USER>;
5#[doc = "Register USER `reset()`'s with value 0"]
6impl crate::ResetValue for super::USER {
7 type Type = u16;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `USER`"]
14pub type USER_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `USER`"]
16pub struct USER_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> USER_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !0x1f) | ((value as u16) & 0x1f);
24 self.w
25 }
26}
27#[doc = "Channel Event Selection\n\nValue on reset: 0"]
28#[derive(Clone, Copy, Debug, PartialEq)]
29#[repr(u8)]
30pub enum CHANNEL_A {
31 #[doc = "0: No Channel Output Selected"]
32 _0 = 0,
33}
34impl From<CHANNEL_A> for u8 {
35 #[inline(always)]
36 fn from(variant: CHANNEL_A) -> Self {
37 variant as _
38 }
39}
40#[doc = "Reader of field `CHANNEL`"]
41pub type CHANNEL_R = crate::R<u8, CHANNEL_A>;
42impl CHANNEL_R {
43 #[doc = r"Get enumerated values variant"]
44 #[inline(always)]
45 pub fn variant(&self) -> crate::Variant<u8, CHANNEL_A> {
46 use crate::Variant::*;
47 match self.bits {
48 0 => Val(CHANNEL_A::_0),
49 i => Res(i),
50 }
51 }
52 #[doc = "Checks if the value of the field is `_0`"]
53 #[inline(always)]
54 pub fn is_0(&self) -> bool {
55 *self == CHANNEL_A::_0
56 }
57}
58#[doc = "Write proxy for field `CHANNEL`"]
59pub struct CHANNEL_W<'a> {
60 w: &'a mut W,
61}
62impl<'a> CHANNEL_W<'a> {
63 #[doc = r"Writes `variant` to the field"]
64 #[inline(always)]
65 pub fn variant(self, variant: CHANNEL_A) -> &'a mut W {
66 unsafe { self.bits(variant.into()) }
67 }
68 #[doc = "No Channel Output Selected"]
69 #[inline(always)]
70 pub fn _0(self) -> &'a mut W {
71 self.variant(CHANNEL_A::_0)
72 }
73 #[doc = r"Writes raw bits to the field"]
74 #[inline(always)]
75 pub unsafe fn bits(self, value: u8) -> &'a mut W {
76 self.w.bits = (self.w.bits & !(0x1f << 8)) | (((value as u16) & 0x1f) << 8);
77 self.w
78 }
79}
80impl R {
81 #[doc = "Bits 0:4 - User Multiplexer Selection"]
82 #[inline(always)]
83 pub fn user(&self) -> USER_R {
84 USER_R::new((self.bits & 0x1f) as u8)
85 }
86 #[doc = "Bits 8:12 - Channel Event Selection"]
87 #[inline(always)]
88 pub fn channel(&self) -> CHANNEL_R {
89 CHANNEL_R::new(((self.bits >> 8) & 0x1f) as u8)
90 }
91}
92impl W {
93 #[doc = "Bits 0:4 - User Multiplexer Selection"]
94 #[inline(always)]
95 pub fn user(&mut self) -> USER_W {
96 USER_W { w: self }
97 }
98 #[doc = "Bits 8:12 - Channel Event Selection"]
99 #[inline(always)]
100 pub fn channel(&mut self) -> CHANNEL_W {
101 CHANNEL_W { w: self }
102 }
103}