esp32p4/lp_ana/
vddbat_charge_cntl.rs

1#[doc = "Register `VDDBAT_CHARGE_CNTL` reader"]
2pub type R = crate::R<VDDBAT_CHARGE_CNTL_SPEC>;
3#[doc = "Register `VDDBAT_CHARGE_CNTL` writer"]
4pub type W = crate::W<VDDBAT_CHARGE_CNTL_SPEC>;
5#[doc = "Field `VDDBAT_CHARGE_UNDERVOLTAGE_FLAG` reader - need_des"]
6pub type VDDBAT_CHARGE_UNDERVOLTAGE_FLAG_R = crate::BitReader;
7#[doc = "Field `VDDBAT_CHARGE_CHARGER` reader - need_des"]
8pub type VDDBAT_CHARGE_CHARGER_R = crate::BitReader;
9#[doc = "Field `VDDBAT_CHARGE_CHARGER` writer - need_des"]
10pub type VDDBAT_CHARGE_CHARGER_W<'a, REG> = crate::BitWriter<'a, REG>;
11#[doc = "Field `VDDBAT_CHARGE_CNT_CLR` reader - need_des"]
12pub type VDDBAT_CHARGE_CNT_CLR_R = crate::BitReader;
13#[doc = "Field `VDDBAT_CHARGE_CNT_CLR` writer - need_des"]
14pub type VDDBAT_CHARGE_CNT_CLR_W<'a, REG> = crate::BitWriter<'a, REG>;
15#[doc = "Field `VDDBAT_CHARGE_UPVOLTAGE_TARGET` reader - need_des"]
16pub type VDDBAT_CHARGE_UPVOLTAGE_TARGET_R = crate::FieldReader<u16>;
17#[doc = "Field `VDDBAT_CHARGE_UPVOLTAGE_TARGET` writer - need_des"]
18pub type VDDBAT_CHARGE_UPVOLTAGE_TARGET_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
19#[doc = "Field `VDDBAT_CHARGE_UNDERVOLTAGE_TARGET` reader - need_des"]
20pub type VDDBAT_CHARGE_UNDERVOLTAGE_TARGET_R = crate::FieldReader<u16>;
21#[doc = "Field `VDDBAT_CHARGE_UNDERVOLTAGE_TARGET` writer - need_des"]
22pub type VDDBAT_CHARGE_UNDERVOLTAGE_TARGET_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
23impl R {
24    #[doc = "Bit 0 - need_des"]
25    #[inline(always)]
26    pub fn vddbat_charge_undervoltage_flag(&self) -> VDDBAT_CHARGE_UNDERVOLTAGE_FLAG_R {
27        VDDBAT_CHARGE_UNDERVOLTAGE_FLAG_R::new((self.bits & 1) != 0)
28    }
29    #[doc = "Bit 10 - need_des"]
30    #[inline(always)]
31    pub fn vddbat_charge_charger(&self) -> VDDBAT_CHARGE_CHARGER_R {
32        VDDBAT_CHARGE_CHARGER_R::new(((self.bits >> 10) & 1) != 0)
33    }
34    #[doc = "Bit 11 - need_des"]
35    #[inline(always)]
36    pub fn vddbat_charge_cnt_clr(&self) -> VDDBAT_CHARGE_CNT_CLR_R {
37        VDDBAT_CHARGE_CNT_CLR_R::new(((self.bits >> 11) & 1) != 0)
38    }
39    #[doc = "Bits 12:21 - need_des"]
40    #[inline(always)]
41    pub fn vddbat_charge_upvoltage_target(&self) -> VDDBAT_CHARGE_UPVOLTAGE_TARGET_R {
42        VDDBAT_CHARGE_UPVOLTAGE_TARGET_R::new(((self.bits >> 12) & 0x03ff) as u16)
43    }
44    #[doc = "Bits 22:31 - need_des"]
45    #[inline(always)]
46    pub fn vddbat_charge_undervoltage_target(&self) -> VDDBAT_CHARGE_UNDERVOLTAGE_TARGET_R {
47        VDDBAT_CHARGE_UNDERVOLTAGE_TARGET_R::new(((self.bits >> 22) & 0x03ff) as u16)
48    }
49}
50#[cfg(feature = "impl-register-debug")]
51impl core::fmt::Debug for R {
52    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
53        f.debug_struct("VDDBAT_CHARGE_CNTL")
54            .field(
55                "vddbat_charge_undervoltage_flag",
56                &format_args!("{}", self.vddbat_charge_undervoltage_flag().bit()),
57            )
58            .field(
59                "vddbat_charge_charger",
60                &format_args!("{}", self.vddbat_charge_charger().bit()),
61            )
62            .field(
63                "vddbat_charge_cnt_clr",
64                &format_args!("{}", self.vddbat_charge_cnt_clr().bit()),
65            )
66            .field(
67                "vddbat_charge_upvoltage_target",
68                &format_args!("{}", self.vddbat_charge_upvoltage_target().bits()),
69            )
70            .field(
71                "vddbat_charge_undervoltage_target",
72                &format_args!("{}", self.vddbat_charge_undervoltage_target().bits()),
73            )
74            .finish()
75    }
76}
77#[cfg(feature = "impl-register-debug")]
78impl core::fmt::Debug for crate::generic::Reg<VDDBAT_CHARGE_CNTL_SPEC> {
79    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
80        core::fmt::Debug::fmt(&self.read(), f)
81    }
82}
83impl W {
84    #[doc = "Bit 10 - need_des"]
85    #[inline(always)]
86    #[must_use]
87    pub fn vddbat_charge_charger(&mut self) -> VDDBAT_CHARGE_CHARGER_W<VDDBAT_CHARGE_CNTL_SPEC> {
88        VDDBAT_CHARGE_CHARGER_W::new(self, 10)
89    }
90    #[doc = "Bit 11 - need_des"]
91    #[inline(always)]
92    #[must_use]
93    pub fn vddbat_charge_cnt_clr(&mut self) -> VDDBAT_CHARGE_CNT_CLR_W<VDDBAT_CHARGE_CNTL_SPEC> {
94        VDDBAT_CHARGE_CNT_CLR_W::new(self, 11)
95    }
96    #[doc = "Bits 12:21 - need_des"]
97    #[inline(always)]
98    #[must_use]
99    pub fn vddbat_charge_upvoltage_target(
100        &mut self,
101    ) -> VDDBAT_CHARGE_UPVOLTAGE_TARGET_W<VDDBAT_CHARGE_CNTL_SPEC> {
102        VDDBAT_CHARGE_UPVOLTAGE_TARGET_W::new(self, 12)
103    }
104    #[doc = "Bits 22:31 - need_des"]
105    #[inline(always)]
106    #[must_use]
107    pub fn vddbat_charge_undervoltage_target(
108        &mut self,
109    ) -> VDDBAT_CHARGE_UNDERVOLTAGE_TARGET_W<VDDBAT_CHARGE_CNTL_SPEC> {
110        VDDBAT_CHARGE_UNDERVOLTAGE_TARGET_W::new(self, 22)
111    }
112}
113#[doc = "need_des\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`vddbat_charge_cntl::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 [`vddbat_charge_cntl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
114pub struct VDDBAT_CHARGE_CNTL_SPEC;
115impl crate::RegisterSpec for VDDBAT_CHARGE_CNTL_SPEC {
116    type Ux = u32;
117}
118#[doc = "`read()` method returns [`vddbat_charge_cntl::R`](R) reader structure"]
119impl crate::Readable for VDDBAT_CHARGE_CNTL_SPEC {}
120#[doc = "`write(|w| ..)` method takes [`vddbat_charge_cntl::W`](W) writer structure"]
121impl crate::Writable for VDDBAT_CHARGE_CNTL_SPEC {
122    type Safety = crate::Unsafe;
123    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
124    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
125}
126#[doc = "`reset()` method sets VDDBAT_CHARGE_CNTL to value 0xffc0_0000"]
127impl crate::Resettable for VDDBAT_CHARGE_CNTL_SPEC {
128    const RESET_VALUE: u32 = 0xffc0_0000;
129}