ra6e1/sysc/
vbattmnselr.rs

1#[doc = "Register `VBATTMNSELR` reader"]
2pub struct R(crate::R<VBATTMNSELR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<VBATTMNSELR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<VBATTMNSELR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<VBATTMNSELR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `VBATTMNSELR` writer"]
17pub struct W(crate::W<VBATTMNSELR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<VBATTMNSELR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<VBATTMNSELR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<VBATTMNSELR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `VBATTMNSEL` reader - VBATT Low Voltage Detect Function Select Bit"]
38pub type VBATTMNSEL_R = crate::BitReader<VBATTMNSEL_A>;
39#[doc = "VBATT Low Voltage Detect Function Select Bit\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum VBATTMNSEL_A {
42    #[doc = "0: Disables VBATT low voltage detect function"]
43    _0 = 0,
44    #[doc = "1: Enables VBATT low voltage detect function"]
45    _1 = 1,
46}
47impl From<VBATTMNSEL_A> for bool {
48    #[inline(always)]
49    fn from(variant: VBATTMNSEL_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl VBATTMNSEL_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> VBATTMNSEL_A {
57        match self.bits {
58            false => VBATTMNSEL_A::_0,
59            true => VBATTMNSEL_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == VBATTMNSEL_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == VBATTMNSEL_A::_1
71    }
72}
73#[doc = "Field `VBATTMNSEL` writer - VBATT Low Voltage Detect Function Select Bit"]
74pub type VBATTMNSEL_W<'a, const O: u8> =
75    crate::BitWriter<'a, u8, VBATTMNSELR_SPEC, VBATTMNSEL_A, O>;
76impl<'a, const O: u8> VBATTMNSEL_W<'a, O> {
77    #[doc = "Disables VBATT low voltage detect function"]
78    #[inline(always)]
79    pub fn _0(self) -> &'a mut W {
80        self.variant(VBATTMNSEL_A::_0)
81    }
82    #[doc = "Enables VBATT low voltage detect function"]
83    #[inline(always)]
84    pub fn _1(self) -> &'a mut W {
85        self.variant(VBATTMNSEL_A::_1)
86    }
87}
88impl R {
89    #[doc = "Bit 0 - VBATT Low Voltage Detect Function Select Bit"]
90    #[inline(always)]
91    pub fn vbattmnsel(&self) -> VBATTMNSEL_R {
92        VBATTMNSEL_R::new((self.bits & 1) != 0)
93    }
94}
95impl W {
96    #[doc = "Bit 0 - VBATT Low Voltage Detect Function Select Bit"]
97    #[inline(always)]
98    #[must_use]
99    pub fn vbattmnsel(&mut self) -> VBATTMNSEL_W<0> {
100        VBATTMNSEL_W::new(self)
101    }
102    #[doc = "Writes raw bits to the register."]
103    #[inline(always)]
104    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
105        self.0.bits(bits);
106        self
107    }
108}
109#[doc = "Battery Backup Voltage Monitor Function Select Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [vbattmnselr](index.html) module"]
110pub struct VBATTMNSELR_SPEC;
111impl crate::RegisterSpec for VBATTMNSELR_SPEC {
112    type Ux = u8;
113}
114#[doc = "`read()` method returns [vbattmnselr::R](R) reader structure"]
115impl crate::Readable for VBATTMNSELR_SPEC {
116    type Reader = R;
117}
118#[doc = "`write(|w| ..)` method takes [vbattmnselr::W](W) writer structure"]
119impl crate::Writable for VBATTMNSELR_SPEC {
120    type Writer = W;
121    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
122    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
123}
124#[doc = "`reset()` method sets VBATTMNSELR to value 0"]
125impl crate::Resettable for VBATTMNSELR_SPEC {
126    const RESET_VALUE: Self::Ux = 0;
127}