1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
#[doc = "Reader of register SLEEP"] pub type R = crate::R<u8, super::SLEEP>; #[doc = "Writer for register SLEEP"] pub type W = crate::W<u8, super::SLEEP>; #[doc = "Register SLEEP `reset()`'s with value 0"] impl crate::ResetValue for super::SLEEP { type Type = u8; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Idle Mode Configuration\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum IDLE_A { #[doc = "0: The CPU clock domain is stopped"] CPU = 0, #[doc = "1: The CPU and AHB clock domains are stopped"] AHB = 1, #[doc = "2: The CPU, AHB and APB clock domains are stopped"] APB = 2, } impl From<IDLE_A> for u8 { #[inline(always)] fn from(variant: IDLE_A) -> Self { variant as _ } } #[doc = "Reader of field `IDLE`"] pub type IDLE_R = crate::R<u8, IDLE_A>; impl IDLE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, IDLE_A> { use crate::Variant::*; match self.bits { 0 => Val(IDLE_A::CPU), 1 => Val(IDLE_A::AHB), 2 => Val(IDLE_A::APB), i => Res(i), } } #[doc = "Checks if the value of the field is `CPU`"] #[inline(always)] pub fn is_cpu(&self) -> bool { *self == IDLE_A::CPU } #[doc = "Checks if the value of the field is `AHB`"] #[inline(always)] pub fn is_ahb(&self) -> bool { *self == IDLE_A::AHB } #[doc = "Checks if the value of the field is `APB`"] #[inline(always)] pub fn is_apb(&self) -> bool { *self == IDLE_A::APB } } #[doc = "Write proxy for field `IDLE`"] pub struct IDLE_W<'a> { w: &'a mut W, } impl<'a> IDLE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IDLE_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "The CPU clock domain is stopped"] #[inline(always)] pub fn cpu(self) -> &'a mut W { self.variant(IDLE_A::CPU) } #[doc = "The CPU and AHB clock domains are stopped"] #[inline(always)] pub fn ahb(self) -> &'a mut W { self.variant(IDLE_A::AHB) } #[doc = "The CPU, AHB and APB clock domains are stopped"] #[inline(always)] pub fn apb(self) -> &'a mut W { self.variant(IDLE_A::APB) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x03) | ((value as u8) & 0x03); self.w } } impl R { #[doc = "Bits 0:1 - Idle Mode Configuration"] #[inline(always)] pub fn idle(&self) -> IDLE_R { IDLE_R::new((self.bits & 0x03) as u8) } } impl W { #[doc = "Bits 0:1 - Idle Mode Configuration"] #[inline(always)] pub fn idle(&mut self) -> IDLE_W { IDLE_W { w: self } } }