d1_pac/rtc/
efuse_hv_pwrswt_ctrl.rs

1#[doc = "Register `efuse_hv_pwrswt_ctrl` reader"]
2pub type R = crate::R<EFUSE_HV_PWRSWT_CTRL_SPEC>;
3#[doc = "Register `efuse_hv_pwrswt_ctrl` writer"]
4pub type W = crate::W<EFUSE_HV_PWRSWT_CTRL_SPEC>;
5#[doc = "Field `efuse_1_8v_power_switch_control` reader - 1: Open power switch 0: Close power switch"]
6pub type EFUSE_1_8V_POWER_SWITCH_CONTROL_R = crate::BitReader<EFUSE_1_8V_POWER_SWITCH_CONTROL_A>;
7#[doc = "1: Open power switch 0: Close power switch\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum EFUSE_1_8V_POWER_SWITCH_CONTROL_A {
10    #[doc = "1: Open power switch"]
11    OPEN = 1,
12    #[doc = "0: Close power switch"]
13    CLOSE = 0,
14}
15impl From<EFUSE_1_8V_POWER_SWITCH_CONTROL_A> for bool {
16    #[inline(always)]
17    fn from(variant: EFUSE_1_8V_POWER_SWITCH_CONTROL_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl EFUSE_1_8V_POWER_SWITCH_CONTROL_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> EFUSE_1_8V_POWER_SWITCH_CONTROL_A {
25        match self.bits {
26            true => EFUSE_1_8V_POWER_SWITCH_CONTROL_A::OPEN,
27            false => EFUSE_1_8V_POWER_SWITCH_CONTROL_A::CLOSE,
28        }
29    }
30    #[doc = "Open power switch"]
31    #[inline(always)]
32    pub fn is_open(&self) -> bool {
33        *self == EFUSE_1_8V_POWER_SWITCH_CONTROL_A::OPEN
34    }
35    #[doc = "Close power switch"]
36    #[inline(always)]
37    pub fn is_close(&self) -> bool {
38        *self == EFUSE_1_8V_POWER_SWITCH_CONTROL_A::CLOSE
39    }
40}
41#[doc = "Field `efuse_1_8v_power_switch_control` writer - 1: Open power switch 0: Close power switch"]
42pub type EFUSE_1_8V_POWER_SWITCH_CONTROL_W<'a, REG> =
43    crate::BitWriter<'a, REG, EFUSE_1_8V_POWER_SWITCH_CONTROL_A>;
44impl<'a, REG> EFUSE_1_8V_POWER_SWITCH_CONTROL_W<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Open power switch"]
49    #[inline(always)]
50    pub fn open(self) -> &'a mut crate::W<REG> {
51        self.variant(EFUSE_1_8V_POWER_SWITCH_CONTROL_A::OPEN)
52    }
53    #[doc = "Close power switch"]
54    #[inline(always)]
55    pub fn close(self) -> &'a mut crate::W<REG> {
56        self.variant(EFUSE_1_8V_POWER_SWITCH_CONTROL_A::CLOSE)
57    }
58}
59impl R {
60    #[doc = "Bit 0 - 1: Open power switch 0: Close power switch"]
61    #[inline(always)]
62    pub fn efuse_1_8v_power_switch_control(&self) -> EFUSE_1_8V_POWER_SWITCH_CONTROL_R {
63        EFUSE_1_8V_POWER_SWITCH_CONTROL_R::new((self.bits & 1) != 0)
64    }
65}
66impl W {
67    #[doc = "Bit 0 - 1: Open power switch 0: Close power switch"]
68    #[inline(always)]
69    #[must_use]
70    pub fn efuse_1_8v_power_switch_control(
71        &mut self,
72    ) -> EFUSE_1_8V_POWER_SWITCH_CONTROL_W<EFUSE_HV_PWRSWT_CTRL_SPEC> {
73        EFUSE_1_8V_POWER_SWITCH_CONTROL_W::new(self, 0)
74    }
75    #[doc = r" Writes raw bits to the register."]
76    #[doc = r""]
77    #[doc = r" # Safety"]
78    #[doc = r""]
79    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
80    #[inline(always)]
81    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
82        self.bits = bits;
83        self
84    }
85}
86#[doc = "Efuse High Voltage Power Switch Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`efuse_hv_pwrswt_ctrl::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`efuse_hv_pwrswt_ctrl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
87pub struct EFUSE_HV_PWRSWT_CTRL_SPEC;
88impl crate::RegisterSpec for EFUSE_HV_PWRSWT_CTRL_SPEC {
89    type Ux = u32;
90}
91#[doc = "`read()` method returns [`efuse_hv_pwrswt_ctrl::R`](R) reader structure"]
92impl crate::Readable for EFUSE_HV_PWRSWT_CTRL_SPEC {}
93#[doc = "`write(|w| ..)` method takes [`efuse_hv_pwrswt_ctrl::W`](W) writer structure"]
94impl crate::Writable for EFUSE_HV_PWRSWT_CTRL_SPEC {
95    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
96    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
97}
98#[doc = "`reset()` method sets efuse_hv_pwrswt_ctrl to value 0"]
99impl crate::Resettable for EFUSE_HV_PWRSWT_CTRL_SPEC {
100    const RESET_VALUE: Self::Ux = 0;
101}