Skip to main content

lpc550x/pmc/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub struct R(crate::R<STATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `BOOTMODE` reader - Latest IC Boot cause:."]
17pub type BOOTMODE_R = crate::FieldReader<u8, BOOTMODE_A>;
18#[doc = "Latest IC Boot cause:.\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20#[repr(u8)]
21pub enum BOOTMODE_A {
22    #[doc = "0: Latest IC boot was a Full power cycle boot sequence (PoR, Pin Reset, Brown Out Detectors Reset, Software Reset)."]
23    POWERUP = 0,
24    #[doc = "1: Latest IC boot was from DEEP SLEEP low power mode."]
25    DEEPSLEEP = 1,
26    #[doc = "2: Latest IC boot was from POWER DOWN low power mode."]
27    POWERDOWN = 2,
28    #[doc = "3: Latest IC boot was from DEEP POWER DOWN low power mode."]
29    DEEPPOWERDOWN = 3,
30}
31impl From<BOOTMODE_A> for u8 {
32    #[inline(always)]
33    fn from(variant: BOOTMODE_A) -> Self {
34        variant as _
35    }
36}
37impl BOOTMODE_R {
38    #[doc = "Get enumerated values variant"]
39    #[inline(always)]
40    pub fn variant(&self) -> BOOTMODE_A {
41        match self.bits {
42            0 => BOOTMODE_A::POWERUP,
43            1 => BOOTMODE_A::DEEPSLEEP,
44            2 => BOOTMODE_A::POWERDOWN,
45            3 => BOOTMODE_A::DEEPPOWERDOWN,
46            _ => unreachable!(),
47        }
48    }
49    #[doc = "Checks if the value of the field is `POWERUP`"]
50    #[inline(always)]
51    pub fn is_powerup(&self) -> bool {
52        *self == BOOTMODE_A::POWERUP
53    }
54    #[doc = "Checks if the value of the field is `DEEPSLEEP`"]
55    #[inline(always)]
56    pub fn is_deepsleep(&self) -> bool {
57        *self == BOOTMODE_A::DEEPSLEEP
58    }
59    #[doc = "Checks if the value of the field is `POWERDOWN`"]
60    #[inline(always)]
61    pub fn is_powerdown(&self) -> bool {
62        *self == BOOTMODE_A::POWERDOWN
63    }
64    #[doc = "Checks if the value of the field is `DEEPPOWERDOWN`"]
65    #[inline(always)]
66    pub fn is_deeppowerdown(&self) -> bool {
67        *self == BOOTMODE_A::DEEPPOWERDOWN
68    }
69}
70impl R {
71    #[doc = "Bits 18:19 - Latest IC Boot cause:."]
72    #[inline(always)]
73    pub fn bootmode(&self) -> BOOTMODE_R {
74        BOOTMODE_R::new(((self.bits >> 18) & 3) as u8)
75    }
76}
77#[doc = "Power Management Controller FSM (Finite State Machines) 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 [status](index.html) module"]
78pub struct STATUS_SPEC;
79impl crate::RegisterSpec for STATUS_SPEC {
80    type Ux = u32;
81}
82#[doc = "`read()` method returns [status::R](R) reader structure"]
83impl crate::Readable for STATUS_SPEC {
84    type Reader = R;
85}
86#[doc = "`reset()` method sets STATUS to value 0"]
87impl crate::Resettable for STATUS_SPEC {
88    #[inline(always)]
89    fn reset_value() -> Self::Ux {
90        0
91    }
92}