stm32wb_pac/flash/
sfr.rs

1#[doc = "Reader of register SFR"]
2pub type R = crate::R<u32, super::SFR>;
3#[doc = "Writer for register SFR"]
4pub type W = crate::W<u32, super::SFR>;
5#[doc = "Register SFR `reset()`'s with value 0xffff_ee00"]
6impl crate::ResetValue for super::SFR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0xffff_ee00
11    }
12}
13#[doc = "Reader of field `SFSA`"]
14pub type SFSA_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `SFSA`"]
16pub struct SFSA_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SFSA_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff);
24        self.w
25    }
26}
27#[doc = "Reader of field `DDS`"]
28pub type DDS_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `DDS`"]
30pub struct DDS_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> DDS_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
48        self.w
49    }
50}
51#[doc = "Reader of field `FSD`"]
52pub type FSD_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `FSD`"]
54pub struct FSD_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> FSD_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
72        self.w
73    }
74}
75impl R {
76    #[doc = "Bits 0:7 - Secure flash start address"]
77    #[inline(always)]
78    pub fn sfsa(&self) -> SFSA_R {
79        SFSA_R::new((self.bits & 0xff) as u8)
80    }
81    #[doc = "Bit 12 - Disable Cortex M0 debug access"]
82    #[inline(always)]
83    pub fn dds(&self) -> DDS_R {
84        DDS_R::new(((self.bits >> 12) & 0x01) != 0)
85    }
86    #[doc = "Bit 8 - Flash security disable"]
87    #[inline(always)]
88    pub fn fsd(&self) -> FSD_R {
89        FSD_R::new(((self.bits >> 8) & 0x01) != 0)
90    }
91}
92impl W {
93    #[doc = "Bits 0:7 - Secure flash start address"]
94    #[inline(always)]
95    pub fn sfsa(&mut self) -> SFSA_W {
96        SFSA_W { w: self }
97    }
98    #[doc = "Bit 12 - Disable Cortex M0 debug access"]
99    #[inline(always)]
100    pub fn dds(&mut self) -> DDS_W {
101        DDS_W { w: self }
102    }
103    #[doc = "Bit 8 - Flash security disable"]
104    #[inline(always)]
105    pub fn fsd(&mut self) -> FSD_W {
106        FSD_W { w: self }
107    }
108}