nrf5340_app_pac/regulators_ns/
mainregstatus.rs

1#[doc = "Register `MAINREGSTATUS` reader"]
2pub struct R(crate::R<MAINREGSTATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<MAINREGSTATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<MAINREGSTATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<MAINREGSTATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `VREGH` reader - VREGH status"]
17pub type VREGH_R = crate::BitReader<VREGH_A>;
18#[doc = "VREGH status\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq)]
20pub enum VREGH_A {
21    #[doc = "0: Normal voltage mode. Voltage supplied on VDD and VDDH."]
22    INACTIVE = 0,
23    #[doc = "1: High voltage mode. Voltage supplied on VDDH."]
24    ACTIVE = 1,
25}
26impl From<VREGH_A> for bool {
27    #[inline(always)]
28    fn from(variant: VREGH_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl VREGH_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> VREGH_A {
36        match self.bits {
37            false => VREGH_A::INACTIVE,
38            true => VREGH_A::ACTIVE,
39        }
40    }
41    #[doc = "Checks if the value of the field is `INACTIVE`"]
42    #[inline(always)]
43    pub fn is_inactive(&self) -> bool {
44        *self == VREGH_A::INACTIVE
45    }
46    #[doc = "Checks if the value of the field is `ACTIVE`"]
47    #[inline(always)]
48    pub fn is_active(&self) -> bool {
49        *self == VREGH_A::ACTIVE
50    }
51}
52impl R {
53    #[doc = "Bit 0 - VREGH status"]
54    #[inline(always)]
55    pub fn vregh(&self) -> VREGH_R {
56        VREGH_R::new((self.bits & 1) != 0)
57    }
58}
59#[doc = "Main supply status\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [mainregstatus](index.html) module"]
60pub struct MAINREGSTATUS_SPEC;
61impl crate::RegisterSpec for MAINREGSTATUS_SPEC {
62    type Ux = u32;
63}
64#[doc = "`read()` method returns [mainregstatus::R](R) reader structure"]
65impl crate::Readable for MAINREGSTATUS_SPEC {
66    type Reader = R;
67}
68#[doc = "`reset()` method sets MAINREGSTATUS to value 0"]
69impl crate::Resettable for MAINREGSTATUS_SPEC {
70    #[inline(always)]
71    fn reset_value() -> Self::Ux {
72        0
73    }
74}