xmc4500/ccu40_cc40/
psl.rs

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