atsamd51p/ccl/
seqctrl.rs

1#[doc = "Register `SEQCTRL[%s]` reader"]
2pub type R = crate::R<SeqctrlSpec>;
3#[doc = "Register `SEQCTRL[%s]` writer"]
4pub type W = crate::W<SeqctrlSpec>;
5#[doc = "Sequential Selection\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum Seqselselect {
9    #[doc = "0: Sequential logic is disabled"]
10    Disable = 0,
11    #[doc = "1: D flip flop"]
12    Dff = 1,
13    #[doc = "2: JK flip flop"]
14    Jk = 2,
15    #[doc = "3: D latch"]
16    Latch = 3,
17    #[doc = "4: RS latch"]
18    Rs = 4,
19}
20impl From<Seqselselect> for u8 {
21    #[inline(always)]
22    fn from(variant: Seqselselect) -> Self {
23        variant as _
24    }
25}
26impl crate::FieldSpec for Seqselselect {
27    type Ux = u8;
28}
29impl crate::IsEnum for Seqselselect {}
30#[doc = "Field `SEQSEL` reader - Sequential Selection"]
31pub type SeqselR = crate::FieldReader<Seqselselect>;
32impl SeqselR {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub const fn variant(&self) -> Option<Seqselselect> {
36        match self.bits {
37            0 => Some(Seqselselect::Disable),
38            1 => Some(Seqselselect::Dff),
39            2 => Some(Seqselselect::Jk),
40            3 => Some(Seqselselect::Latch),
41            4 => Some(Seqselselect::Rs),
42            _ => None,
43        }
44    }
45    #[doc = "Sequential logic is disabled"]
46    #[inline(always)]
47    pub fn is_disable(&self) -> bool {
48        *self == Seqselselect::Disable
49    }
50    #[doc = "D flip flop"]
51    #[inline(always)]
52    pub fn is_dff(&self) -> bool {
53        *self == Seqselselect::Dff
54    }
55    #[doc = "JK flip flop"]
56    #[inline(always)]
57    pub fn is_jk(&self) -> bool {
58        *self == Seqselselect::Jk
59    }
60    #[doc = "D latch"]
61    #[inline(always)]
62    pub fn is_latch(&self) -> bool {
63        *self == Seqselselect::Latch
64    }
65    #[doc = "RS latch"]
66    #[inline(always)]
67    pub fn is_rs(&self) -> bool {
68        *self == Seqselselect::Rs
69    }
70}
71#[doc = "Field `SEQSEL` writer - Sequential Selection"]
72pub type SeqselW<'a, REG> = crate::FieldWriter<'a, REG, 4, Seqselselect>;
73impl<'a, REG> SeqselW<'a, REG>
74where
75    REG: crate::Writable + crate::RegisterSpec,
76    REG::Ux: From<u8>,
77{
78    #[doc = "Sequential logic is disabled"]
79    #[inline(always)]
80    pub fn disable(self) -> &'a mut crate::W<REG> {
81        self.variant(Seqselselect::Disable)
82    }
83    #[doc = "D flip flop"]
84    #[inline(always)]
85    pub fn dff(self) -> &'a mut crate::W<REG> {
86        self.variant(Seqselselect::Dff)
87    }
88    #[doc = "JK flip flop"]
89    #[inline(always)]
90    pub fn jk(self) -> &'a mut crate::W<REG> {
91        self.variant(Seqselselect::Jk)
92    }
93    #[doc = "D latch"]
94    #[inline(always)]
95    pub fn latch(self) -> &'a mut crate::W<REG> {
96        self.variant(Seqselselect::Latch)
97    }
98    #[doc = "RS latch"]
99    #[inline(always)]
100    pub fn rs(self) -> &'a mut crate::W<REG> {
101        self.variant(Seqselselect::Rs)
102    }
103}
104impl R {
105    #[doc = "Bits 0:3 - Sequential Selection"]
106    #[inline(always)]
107    pub fn seqsel(&self) -> SeqselR {
108        SeqselR::new(self.bits & 0x0f)
109    }
110}
111impl W {
112    #[doc = "Bits 0:3 - Sequential Selection"]
113    #[inline(always)]
114    #[must_use]
115    pub fn seqsel(&mut self) -> SeqselW<SeqctrlSpec> {
116        SeqselW::new(self, 0)
117    }
118}
119#[doc = "SEQ Control x\n\nYou can [`read`](crate::Reg::read) this register and get [`seqctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`seqctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
120pub struct SeqctrlSpec;
121impl crate::RegisterSpec for SeqctrlSpec {
122    type Ux = u8;
123}
124#[doc = "`read()` method returns [`seqctrl::R`](R) reader structure"]
125impl crate::Readable for SeqctrlSpec {}
126#[doc = "`write(|w| ..)` method takes [`seqctrl::W`](W) writer structure"]
127impl crate::Writable for SeqctrlSpec {
128    type Safety = crate::Unsafe;
129    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
130    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
131}
132#[doc = "`reset()` method sets SEQCTRL[%s]
133to value 0"]
134impl crate::Resettable for SeqctrlSpec {
135    const RESET_VALUE: u8 = 0;
136}