atsamd51g/dmac/channel/
chprilvl.rs
1#[doc = "Register `CHPRILVL` reader"]
2pub type R = crate::R<ChprilvlSpec>;
3#[doc = "Register `CHPRILVL` writer"]
4pub type W = crate::W<ChprilvlSpec>;
5#[doc = "Channel Priority Level\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Prilvlselect {
9 #[doc = "0: Channel Priority Level 0 (Lowest Level)"]
10 Lvl0 = 0,
11 #[doc = "1: Channel Priority Level 1"]
12 Lvl1 = 1,
13 #[doc = "2: Channel Priority Level 2"]
14 Lvl2 = 2,
15 #[doc = "3: Channel Priority Level 3 (Highest Level)"]
16 Lvl3 = 3,
17}
18impl From<Prilvlselect> for u8 {
19 #[inline(always)]
20 fn from(variant: Prilvlselect) -> Self {
21 variant as _
22 }
23}
24impl crate::FieldSpec for Prilvlselect {
25 type Ux = u8;
26}
27impl crate::IsEnum for Prilvlselect {}
28#[doc = "Field `PRILVL` reader - Channel Priority Level"]
29pub type PrilvlR = crate::FieldReader<Prilvlselect>;
30impl PrilvlR {
31 #[doc = "Get enumerated values variant"]
32 #[inline(always)]
33 pub const fn variant(&self) -> Prilvlselect {
34 match self.bits {
35 0 => Prilvlselect::Lvl0,
36 1 => Prilvlselect::Lvl1,
37 2 => Prilvlselect::Lvl2,
38 3 => Prilvlselect::Lvl3,
39 _ => unreachable!(),
40 }
41 }
42 #[doc = "Channel Priority Level 0 (Lowest Level)"]
43 #[inline(always)]
44 pub fn is_lvl0(&self) -> bool {
45 *self == Prilvlselect::Lvl0
46 }
47 #[doc = "Channel Priority Level 1"]
48 #[inline(always)]
49 pub fn is_lvl1(&self) -> bool {
50 *self == Prilvlselect::Lvl1
51 }
52 #[doc = "Channel Priority Level 2"]
53 #[inline(always)]
54 pub fn is_lvl2(&self) -> bool {
55 *self == Prilvlselect::Lvl2
56 }
57 #[doc = "Channel Priority Level 3 (Highest Level)"]
58 #[inline(always)]
59 pub fn is_lvl3(&self) -> bool {
60 *self == Prilvlselect::Lvl3
61 }
62}
63#[doc = "Field `PRILVL` writer - Channel Priority Level"]
64pub type PrilvlW<'a, REG> = crate::FieldWriter<'a, REG, 2, Prilvlselect, crate::Safe>;
65impl<'a, REG> PrilvlW<'a, REG>
66where
67 REG: crate::Writable + crate::RegisterSpec,
68 REG::Ux: From<u8>,
69{
70 #[doc = "Channel Priority Level 0 (Lowest Level)"]
71 #[inline(always)]
72 pub fn lvl0(self) -> &'a mut crate::W<REG> {
73 self.variant(Prilvlselect::Lvl0)
74 }
75 #[doc = "Channel Priority Level 1"]
76 #[inline(always)]
77 pub fn lvl1(self) -> &'a mut crate::W<REG> {
78 self.variant(Prilvlselect::Lvl1)
79 }
80 #[doc = "Channel Priority Level 2"]
81 #[inline(always)]
82 pub fn lvl2(self) -> &'a mut crate::W<REG> {
83 self.variant(Prilvlselect::Lvl2)
84 }
85 #[doc = "Channel Priority Level 3 (Highest Level)"]
86 #[inline(always)]
87 pub fn lvl3(self) -> &'a mut crate::W<REG> {
88 self.variant(Prilvlselect::Lvl3)
89 }
90}
91impl R {
92 #[doc = "Bits 0:1 - Channel Priority Level"]
93 #[inline(always)]
94 pub fn prilvl(&self) -> PrilvlR {
95 PrilvlR::new(self.bits & 3)
96 }
97}
98impl W {
99 #[doc = "Bits 0:1 - Channel Priority Level"]
100 #[inline(always)]
101 #[must_use]
102 pub fn prilvl(&mut self) -> PrilvlW<ChprilvlSpec> {
103 PrilvlW::new(self, 0)
104 }
105}
106#[doc = "Channel n Priority Level\n\nYou can [`read`](crate::Reg::read) this register and get [`chprilvl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`chprilvl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
107pub struct ChprilvlSpec;
108impl crate::RegisterSpec for ChprilvlSpec {
109 type Ux = u8;
110}
111#[doc = "`read()` method returns [`chprilvl::R`](R) reader structure"]
112impl crate::Readable for ChprilvlSpec {}
113#[doc = "`write(|w| ..)` method takes [`chprilvl::W`](W) writer structure"]
114impl crate::Writable for ChprilvlSpec {
115 type Safety = crate::Unsafe;
116 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
117 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
118}
119#[doc = "`reset()` method sets CHPRILVL to value 0"]
120impl crate::Resettable for ChprilvlSpec {
121 const RESET_VALUE: u8 = 0;
122}