stm32wb_pac/syscfg/
scsr.rs

1#[doc = "Reader of register SCSR"]
2pub type R = crate::R<u32, super::SCSR>;
3#[doc = "Writer for register SCSR"]
4pub type W = crate::W<u32, super::SCSR>;
5#[doc = "Register SCSR `reset()`'s with value 0"]
6impl crate::ResetValue for super::SCSR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SRAM2BSY`"]
14pub type SRAM2BSY_R = crate::R<bool, bool>;
15#[doc = "Reader of field `SRAM2ER`"]
16pub type SRAM2ER_R = crate::R<bool, bool>;
17#[doc = "Write proxy for field `SRAM2ER`"]
18pub struct SRAM2ER_W<'a> {
19    w: &'a mut W,
20}
21impl<'a> SRAM2ER_W<'a> {
22    #[doc = r"Sets the field bit"]
23    #[inline(always)]
24    pub fn set_bit(self) -> &'a mut W {
25        self.bit(true)
26    }
27    #[doc = r"Clears the field bit"]
28    #[inline(always)]
29    pub fn clear_bit(self) -> &'a mut W {
30        self.bit(false)
31    }
32    #[doc = r"Writes raw bits to the field"]
33    #[inline(always)]
34    pub fn bit(self, value: bool) -> &'a mut W {
35        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
36        self.w
37    }
38}
39#[doc = "Reader of field `C2RFD`"]
40pub type C2RFD_R = crate::R<bool, bool>;
41#[doc = "Write proxy for field `C2RFD`"]
42pub struct C2RFD_W<'a> {
43    w: &'a mut W,
44}
45impl<'a> C2RFD_W<'a> {
46    #[doc = r"Sets the field bit"]
47    #[inline(always)]
48    pub fn set_bit(self) -> &'a mut W {
49        self.bit(true)
50    }
51    #[doc = r"Clears the field bit"]
52    #[inline(always)]
53    pub fn clear_bit(self) -> &'a mut W {
54        self.bit(false)
55    }
56    #[doc = r"Writes raw bits to the field"]
57    #[inline(always)]
58    pub fn bit(self, value: bool) -> &'a mut W {
59        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
60        self.w
61    }
62}
63impl R {
64    #[doc = "Bit 1 - SRAM2 busy by erase operation"]
65    #[inline(always)]
66    pub fn sram2bsy(&self) -> SRAM2BSY_R {
67        SRAM2BSY_R::new(((self.bits >> 1) & 0x01) != 0)
68    }
69    #[doc = "Bit 0 - SRAM2 Erase"]
70    #[inline(always)]
71    pub fn sram2er(&self) -> SRAM2ER_R {
72        SRAM2ER_R::new((self.bits & 0x01) != 0)
73    }
74    #[doc = "Bit 31 - CPU2 SRAM fetch (execution) disable."]
75    #[inline(always)]
76    pub fn c2rfd(&self) -> C2RFD_R {
77        C2RFD_R::new(((self.bits >> 31) & 0x01) != 0)
78    }
79}
80impl W {
81    #[doc = "Bit 0 - SRAM2 Erase"]
82    #[inline(always)]
83    pub fn sram2er(&mut self) -> SRAM2ER_W {
84        SRAM2ER_W { w: self }
85    }
86    #[doc = "Bit 31 - CPU2 SRAM fetch (execution) disable."]
87    #[inline(always)]
88    pub fn c2rfd(&mut self) -> C2RFD_W {
89        C2RFD_W { w: self }
90    }
91}