nrf52840_pac/power/
systemoff.rs
1#[doc = "Register `SYSTEMOFF` writer"]
2pub struct W(crate::W<SYSTEMOFF_SPEC>);
3impl core::ops::Deref for W {
4 type Target = crate::W<SYSTEMOFF_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl core::ops::DerefMut for W {
11 #[inline(always)]
12 fn deref_mut(&mut self) -> &mut Self::Target {
13 &mut self.0
14 }
15}
16impl From<crate::W<SYSTEMOFF_SPEC>> for W {
17 #[inline(always)]
18 fn from(writer: crate::W<SYSTEMOFF_SPEC>) -> Self {
19 W(writer)
20 }
21}
22#[doc = "Enable System OFF mode\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq)]
24pub enum SYSTEMOFF_AW {
25 #[doc = "1: Enable System OFF mode"]
26 ENTER = 1,
27}
28impl From<SYSTEMOFF_AW> for bool {
29 #[inline(always)]
30 fn from(variant: SYSTEMOFF_AW) -> Self {
31 variant as u8 != 0
32 }
33}
34#[doc = "Field `SYSTEMOFF` writer - Enable System OFF mode"]
35pub type SYSTEMOFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, SYSTEMOFF_SPEC, SYSTEMOFF_AW, O>;
36impl<'a, const O: u8> SYSTEMOFF_W<'a, O> {
37 #[doc = "Enable System OFF mode"]
38 #[inline(always)]
39 pub fn enter(self) -> &'a mut W {
40 self.variant(SYSTEMOFF_AW::ENTER)
41 }
42}
43impl W {
44 #[doc = "Bit 0 - Enable System OFF mode"]
45 #[inline(always)]
46 pub fn systemoff(&mut self) -> SYSTEMOFF_W<0> {
47 SYSTEMOFF_W::new(self)
48 }
49 #[doc = "Writes raw bits to the register."]
50 #[inline(always)]
51 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
52 self.0.bits(bits);
53 self
54 }
55}
56#[doc = "System OFF register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [systemoff](index.html) module"]
57pub struct SYSTEMOFF_SPEC;
58impl crate::RegisterSpec for SYSTEMOFF_SPEC {
59 type Ux = u32;
60}
61#[doc = "`write(|w| ..)` method takes [systemoff::W](W) writer structure"]
62impl crate::Writable for SYSTEMOFF_SPEC {
63 type Writer = W;
64}
65#[doc = "`reset()` method sets SYSTEMOFF to value 0"]
66impl crate::Resettable for SYSTEMOFF_SPEC {
67 #[inline(always)]
68 fn reset_value() -> Self::Ux {
69 0
70 }
71}