atsamd21g/evsys/
user.rs
1#[doc = "Register `USER` reader"]
2pub type R = crate::R<UserSpec>;
3#[doc = "Register `USER` writer"]
4pub type W = crate::W<UserSpec>;
5#[doc = "Field `USER` reader - User Multiplexer Selection"]
6pub type UserR = crate::FieldReader;
7#[doc = "Field `USER` writer - User Multiplexer Selection"]
8pub type UserW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
9#[doc = "Channel Event Selection\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11#[repr(u8)]
12pub enum Channelselect {
13 #[doc = "0: No Channel Output Selected"]
14 _0 = 0,
15}
16impl From<Channelselect> for u8 {
17 #[inline(always)]
18 fn from(variant: Channelselect) -> Self {
19 variant as _
20 }
21}
22impl crate::FieldSpec for Channelselect {
23 type Ux = u8;
24}
25impl crate::IsEnum for Channelselect {}
26#[doc = "Field `CHANNEL` reader - Channel Event Selection"]
27pub type ChannelR = crate::FieldReader<Channelselect>;
28impl ChannelR {
29 #[doc = "Get enumerated values variant"]
30 #[inline(always)]
31 pub const fn variant(&self) -> Option<Channelselect> {
32 match self.bits {
33 0 => Some(Channelselect::_0),
34 _ => None,
35 }
36 }
37 #[doc = "No Channel Output Selected"]
38 #[inline(always)]
39 pub fn is_0(&self) -> bool {
40 *self == Channelselect::_0
41 }
42}
43#[doc = "Field `CHANNEL` writer - Channel Event Selection"]
44pub type ChannelW<'a, REG> = crate::FieldWriter<'a, REG, 5, Channelselect>;
45impl<'a, REG> ChannelW<'a, REG>
46where
47 REG: crate::Writable + crate::RegisterSpec,
48 REG::Ux: From<u8>,
49{
50 #[doc = "No Channel Output Selected"]
51 #[inline(always)]
52 pub fn _0(self) -> &'a mut crate::W<REG> {
53 self.variant(Channelselect::_0)
54 }
55}
56impl R {
57 #[doc = "Bits 0:4 - User Multiplexer Selection"]
58 #[inline(always)]
59 pub fn user(&self) -> UserR {
60 UserR::new((self.bits & 0x1f) as u8)
61 }
62 #[doc = "Bits 8:12 - Channel Event Selection"]
63 #[inline(always)]
64 pub fn channel(&self) -> ChannelR {
65 ChannelR::new(((self.bits >> 8) & 0x1f) as u8)
66 }
67}
68impl W {
69 #[doc = "Bits 0:4 - User Multiplexer Selection"]
70 #[inline(always)]
71 #[must_use]
72 pub fn user(&mut self) -> UserW<UserSpec> {
73 UserW::new(self, 0)
74 }
75 #[doc = "Bits 8:12 - Channel Event Selection"]
76 #[inline(always)]
77 #[must_use]
78 pub fn channel(&mut self) -> ChannelW<UserSpec> {
79 ChannelW::new(self, 8)
80 }
81}
82#[doc = "User Multiplexer\n\nYou can [`read`](crate::Reg::read) this register and get [`user::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`user::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
83pub struct UserSpec;
84impl crate::RegisterSpec for UserSpec {
85 type Ux = u16;
86}
87#[doc = "`read()` method returns [`user::R`](R) reader structure"]
88impl crate::Readable for UserSpec {}
89#[doc = "`write(|w| ..)` method takes [`user::W`](W) writer structure"]
90impl crate::Writable for UserSpec {
91 type Safety = crate::Unsafe;
92 const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
93 const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
94}
95#[doc = "`reset()` method sets USER to value 0"]
96impl crate::Resettable for UserSpec {
97 const RESET_VALUE: u16 = 0;
98}