1#[doc = "Reader of register CHASGN"]
2pub type R = crate::R<u32, super::CHASGN>;
3#[doc = "Writer for register CHASGN"]
4pub type W = crate::W<u32, super::CHASGN>;
5#[doc = "Register CHASGN `reset()`'s with value 0"]
6impl crate::ResetValue for super::CHASGN {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Channel \\[n\\]
14Assignment Select\n\nValue on reset: 0"]
15#[derive(Clone, Copy, Debug, PartialEq)]
16#[repr(u32)]
17pub enum CHASGN_A {
18 #[doc = "0: Use the primary channel assignment"]
19 PRIMARY = 0,
20 #[doc = "1: Use the secondary channel assignment"]
21 SECONDARY = 1,
22}
23impl From<CHASGN_A> for u32 {
24 #[inline(always)]
25 fn from(variant: CHASGN_A) -> Self {
26 variant as _
27 }
28}
29#[doc = "Reader of field `CHASGN`"]
30pub type CHASGN_R = crate::R<u32, CHASGN_A>;
31impl CHASGN_R {
32 #[doc = r"Get enumerated values variant"]
33 #[inline(always)]
34 pub fn variant(&self) -> crate::Variant<u32, CHASGN_A> {
35 use crate::Variant::*;
36 match self.bits {
37 0 => Val(CHASGN_A::PRIMARY),
38 1 => Val(CHASGN_A::SECONDARY),
39 i => Res(i),
40 }
41 }
42 #[doc = "Checks if the value of the field is `PRIMARY`"]
43 #[inline(always)]
44 pub fn is_primary(&self) -> bool {
45 *self == CHASGN_A::PRIMARY
46 }
47 #[doc = "Checks if the value of the field is `SECONDARY`"]
48 #[inline(always)]
49 pub fn is_secondary(&self) -> bool {
50 *self == CHASGN_A::SECONDARY
51 }
52}
53#[doc = "Write proxy for field `CHASGN`"]
54pub struct CHASGN_W<'a> {
55 w: &'a mut W,
56}
57impl<'a> CHASGN_W<'a> {
58 #[doc = r"Writes `variant` to the field"]
59 #[inline(always)]
60 pub fn variant(self, variant: CHASGN_A) -> &'a mut W {
61 unsafe { self.bits(variant.into()) }
62 }
63 #[doc = "Use the primary channel assignment"]
64 #[inline(always)]
65 pub fn primary(self) -> &'a mut W {
66 self.variant(CHASGN_A::PRIMARY)
67 }
68 #[doc = "Use the secondary channel assignment"]
69 #[inline(always)]
70 pub fn secondary(self) -> &'a mut W {
71 self.variant(CHASGN_A::SECONDARY)
72 }
73 #[doc = r"Writes raw bits to the field"]
74 #[inline(always)]
75 pub unsafe fn bits(self, value: u32) -> &'a mut W {
76 self.w.bits = (self.w.bits & !0xffff_ffff) | ((value as u32) & 0xffff_ffff);
77 self.w
78 }
79}
80impl R {
81 #[doc = "Bits 0:31 - Channel \\[n\\]
82Assignment Select"]
83 #[inline(always)]
84 pub fn chasgn(&self) -> CHASGN_R {
85 CHASGN_R::new((self.bits & 0xffff_ffff) as u32)
86 }
87}
88impl W {
89 #[doc = "Bits 0:31 - Channel \\[n\\]
90Assignment Select"]
91 #[inline(always)]
92 pub fn chasgn(&mut self) -> CHASGN_W {
93 CHASGN_W { w: self }
94 }
95}