1#[doc = "Register `POWER` reader"]
2pub struct R(crate::R<POWER_SPEC>);
3impl core::ops::Deref for R {
4type Target = crate::R<POWER_SPEC>;
5#[inline(always)]
6fn deref(&self) -> &Self::Target {
7&self.0
8}
9}
10impl From<crate::R<POWER_SPEC>> for R {
11#[inline(always)]
12fn from(reader: crate::R<POWER_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `POWER` writer"]
17pub struct W(crate::W<POWER_SPEC>);
18impl core::ops::Deref for W {
19type Target = crate::W<POWER_SPEC>;
20#[inline(always)]
21fn deref(&self) -> &Self::Target {
22&self.0
23}
24}
25impl core::ops::DerefMut for W {
26#[inline(always)]
27fn deref_mut(&mut self) -> &mut Self::Target {
28&mut self.0
29}
30}
31impl From<crate::W<POWER_SPEC>> for W {
32#[inline(always)]
33fn from(writer: crate::W<POWER_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `POWER` reader - Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again."]
38pub type POWER_R = crate::BitReader<POWER_A>;
39#[doc = "Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again.\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum POWER_A {
42#[doc = "0: Peripheral is powered off"]
43DISABLED = 0,
44#[doc = "1: Peripheral is powered on"]
45ENABLED = 1,
46}
47impl From<POWER_A> for bool {
48#[inline(always)]
49fn from(variant: POWER_A) -> Self {
50 variant as u8 != 0
51}
52}
53impl POWER_R {
54#[doc = "Get enumerated values variant"]
55 #[inline(always)]
56pub fn variant(&self) -> POWER_A {
57match self.bits {
58false => POWER_A::DISABLED,
59true => POWER_A::ENABLED,
60 }
61 }
62#[doc = "Checks if the value of the field is `DISABLED`"]
63 #[inline(always)]
64pub fn is_disabled(&self) -> bool {
65*self == POWER_A::DISABLED
66 }
67#[doc = "Checks if the value of the field is `ENABLED`"]
68 #[inline(always)]
69pub fn is_enabled(&self) -> bool {
70*self == POWER_A::ENABLED
71 }
72}
73#[doc = "Field `POWER` writer - Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again."]
74pub type POWER_W<'a, const O: u8> = crate::BitWriter<'a, u32, POWER_SPEC, POWER_A, O>;
75impl<'a, const O: u8> POWER_W<'a, O> {
76#[doc = "Peripheral is powered off"]
77 #[inline(always)]
78pub fn disabled(self) -> &'a mut W {
79self.variant(POWER_A::DISABLED)
80 }
81#[doc = "Peripheral is powered on"]
82 #[inline(always)]
83pub fn enabled(self) -> &'a mut W {
84self.variant(POWER_A::ENABLED)
85 }
86}
87impl R {
88#[doc = "Bit 0 - Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again."]
89 #[inline(always)]
90pub fn power(&self) -> POWER_R {
91 POWER_R::new((self.bits & 1) != 0)
92 }
93}
94impl W {
95#[doc = "Bit 0 - Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again."]
96 #[inline(always)]
97pub fn power(&mut self) -> POWER_W<0> {
98 POWER_W::new(self)
99 }
100#[doc = "Writes raw bits to the register."]
101 #[inline(always)]
102pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
103self.0.bits(bits);
104self
105}
106}
107#[doc = "Peripheral power control\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 [power](index.html) module"]
108pub struct POWER_SPEC;
109impl crate::RegisterSpec for POWER_SPEC {
110type Ux = u32;
111}
112#[doc = "`read()` method returns [power::R](R) reader structure"]
113impl crate::Readable for POWER_SPEC {
114type Reader = R;
115}
116#[doc = "`write(|w| ..)` method takes [power::W](W) writer structure"]
117impl crate::Writable for POWER_SPEC {
118type Writer = W;
119}
120#[doc = "`reset()` method sets POWER to value 0x01"]
121impl crate::Resettable for POWER_SPEC {
122#[inline(always)]
123fn reset_value() -> Self::Ux {
1240x01
125}
126}