xmc4100/scu_clk/
pbclkcr.rs1#[doc = "Register `PBCLKCR` reader"]
2pub type R = crate::R<PBCLKCR_SPEC>;
3#[doc = "Register `PBCLKCR` writer"]
4pub type W = crate::W<PBCLKCR_SPEC>;
5#[doc = "PB Clock Divider Enable\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum PBDIV_A {
8 #[doc = "0: fPERIPH = fCPU"]
9 VALUE1 = 0,
10 #[doc = "1: fPERIPH = fCPU / 2"]
11 VALUE2 = 1,
12}
13impl From<PBDIV_A> for bool {
14 #[inline(always)]
15 fn from(variant: PBDIV_A) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Field `PBDIV` reader - PB Clock Divider Enable"]
20pub type PBDIV_R = crate::BitReader<PBDIV_A>;
21impl PBDIV_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> PBDIV_A {
25 match self.bits {
26 false => PBDIV_A::VALUE1,
27 true => PBDIV_A::VALUE2,
28 }
29 }
30 #[doc = "fPERIPH = fCPU"]
31 #[inline(always)]
32 pub fn is_value1(&self) -> bool {
33 *self == PBDIV_A::VALUE1
34 }
35 #[doc = "fPERIPH = fCPU / 2"]
36 #[inline(always)]
37 pub fn is_value2(&self) -> bool {
38 *self == PBDIV_A::VALUE2
39 }
40}
41#[doc = "Field `PBDIV` writer - PB Clock Divider Enable"]
42pub type PBDIV_W<'a, REG> = crate::BitWriter<'a, REG, PBDIV_A>;
43impl<'a, REG> PBDIV_W<'a, REG>
44where
45 REG: crate::Writable + crate::RegisterSpec,
46{
47 #[doc = "fPERIPH = fCPU"]
48 #[inline(always)]
49 pub fn value1(self) -> &'a mut crate::W<REG> {
50 self.variant(PBDIV_A::VALUE1)
51 }
52 #[doc = "fPERIPH = fCPU / 2"]
53 #[inline(always)]
54 pub fn value2(self) -> &'a mut crate::W<REG> {
55 self.variant(PBDIV_A::VALUE2)
56 }
57}
58impl R {
59 #[doc = "Bit 0 - PB Clock Divider Enable"]
60 #[inline(always)]
61 pub fn pbdiv(&self) -> PBDIV_R {
62 PBDIV_R::new((self.bits & 1) != 0)
63 }
64}
65impl W {
66 #[doc = "Bit 0 - PB Clock Divider Enable"]
67 #[inline(always)]
68 pub fn pbdiv(&mut self) -> PBDIV_W<PBCLKCR_SPEC> {
69 PBDIV_W::new(self, 0)
70 }
71}
72#[doc = "Peripheral Bus Clock Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`pbclkcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pbclkcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
73pub struct PBCLKCR_SPEC;
74impl crate::RegisterSpec for PBCLKCR_SPEC {
75 type Ux = u32;
76}
77#[doc = "`read()` method returns [`pbclkcr::R`](R) reader structure"]
78impl crate::Readable for PBCLKCR_SPEC {}
79#[doc = "`write(|w| ..)` method takes [`pbclkcr::W`](W) writer structure"]
80impl crate::Writable for PBCLKCR_SPEC {
81 type Safety = crate::Unsafe;
82 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
83 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
84}
85#[doc = "`reset()` method sets PBCLKCR to value 0"]
86impl crate::Resettable for PBCLKCR_SPEC {
87 const RESET_VALUE: u32 = 0;
88}