tm4c129x/ssi0/
cc.rs

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