d1_pac/riscv_cfg/
work_mode.rs1#[doc = "Register `work_mode` reader"]
2pub type R = crate::R<WORK_MODE_SPEC>;
3#[doc = "Field `wm_sta` reader - Work Mode Status"]
4pub type WM_STA_R = crate::FieldReader<WM_STA_A>;
5#[doc = "Work Mode Status\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum WM_STA_A {
9 #[doc = "0: `0`"]
10 NORMAL = 0,
11 #[doc = "1: `1`"]
12 LOW_POWER = 1,
13 #[doc = "2: `10`"]
14 DEBUG = 2,
15}
16impl From<WM_STA_A> for u8 {
17 #[inline(always)]
18 fn from(variant: WM_STA_A) -> Self {
19 variant as _
20 }
21}
22impl crate::FieldSpec for WM_STA_A {
23 type Ux = u8;
24}
25impl WM_STA_R {
26 #[doc = "Get enumerated values variant"]
27 #[inline(always)]
28 pub const fn variant(&self) -> Option<WM_STA_A> {
29 match self.bits {
30 0 => Some(WM_STA_A::NORMAL),
31 1 => Some(WM_STA_A::LOW_POWER),
32 2 => Some(WM_STA_A::DEBUG),
33 _ => None,
34 }
35 }
36 #[doc = "`0`"]
37 #[inline(always)]
38 pub fn is_normal(&self) -> bool {
39 *self == WM_STA_A::NORMAL
40 }
41 #[doc = "`1`"]
42 #[inline(always)]
43 pub fn is_low_power(&self) -> bool {
44 *self == WM_STA_A::LOW_POWER
45 }
46 #[doc = "`10`"]
47 #[inline(always)]
48 pub fn is_debug(&self) -> bool {
49 *self == WM_STA_A::DEBUG
50 }
51}
52impl R {
53 #[doc = "Bits 0:1 - Work Mode Status"]
54 #[inline(always)]
55 pub fn wm_sta(&self) -> WM_STA_R {
56 WM_STA_R::new((self.bits & 3) as u8)
57 }
58}
59#[doc = "Work Mode Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`work_mode::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
60pub struct WORK_MODE_SPEC;
61impl crate::RegisterSpec for WORK_MODE_SPEC {
62 type Ux = u32;
63}
64#[doc = "`read()` method returns [`work_mode::R`](R) reader structure"]
65impl crate::Readable for WORK_MODE_SPEC {}
66#[doc = "`reset()` method sets work_mode to value 0"]
67impl crate::Resettable for WORK_MODE_SPEC {
68 const RESET_VALUE: Self::Ux = 0;
69}