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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#[doc = "Register `OBSTAT` reader"]
pub type R = crate::R<ObstatSpec>;
#[doc = "Option byte read error\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Oberr {
    #[doc = "0: No error with option bytes"]
    NoError = 0,
    #[doc = "1: Option bytes and complement bytes do not match"]
    Error = 1,
}
impl From<Oberr> for bool {
    #[inline(always)]
    fn from(variant: Oberr) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `OBERR` reader - Option byte read error"]
pub type OberrR = crate::BitReader<Oberr>;
impl OberrR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Oberr {
        match self.bits {
            false => Oberr::NoError,
            true => Oberr::Error,
        }
    }
    #[doc = "No error with option bytes"]
    #[inline(always)]
    pub fn is_no_error(&self) -> bool {
        *self == Oberr::NoError
    }
    #[doc = "Option bytes and complement bytes do not match"]
    #[inline(always)]
    pub fn is_error(&self) -> bool {
        *self == Oberr::Error
    }
}
#[doc = "Security Protection level\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Plevel {
    #[doc = "0: No protection level"]
    None = 0,
    #[doc = "1: Low protection level"]
    Low = 1,
    #[doc = "3: High protection level"]
    High = 3,
}
impl From<Plevel> for u8 {
    #[inline(always)]
    fn from(variant: Plevel) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Plevel {
    type Ux = u8;
}
#[doc = "Field `PLEVEL` reader - Security Protection level"]
pub type PlevelR = crate::FieldReader<Plevel>;
impl PlevelR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Plevel> {
        match self.bits {
            0 => Some(Plevel::None),
            1 => Some(Plevel::Low),
            3 => Some(Plevel::High),
            _ => None,
        }
    }
    #[doc = "No protection level"]
    #[inline(always)]
    pub fn is_none(&self) -> bool {
        *self == Plevel::None
    }
    #[doc = "Low protection level"]
    #[inline(always)]
    pub fn is_low(&self) -> bool {
        *self == Plevel::Low
    }
    #[doc = "High protection level"]
    #[inline(always)]
    pub fn is_high(&self) -> bool {
        *self == Plevel::High
    }
}
#[doc = "Field `OB_USER` reader - Store OB_USER byte of option byte block after system reset"]
pub type ObUserR = crate::FieldReader;
#[doc = "Field `OB_DATA` reader - Store OB_DATA\\[15:0\\]
of option byte block after system reset"]
pub type ObDataR = crate::FieldReader<u16>;
impl R {
    #[doc = "Bit 0 - Option byte read error"]
    #[inline(always)]
    pub fn oberr(&self) -> OberrR {
        OberrR::new((self.bits & 1) != 0)
    }
    #[doc = "Bits 1:2 - Security Protection level"]
    #[inline(always)]
    pub fn plevel(&self) -> PlevelR {
        PlevelR::new(((self.bits >> 1) & 3) as u8)
    }
    #[doc = "Bits 8:15 - Store OB_USER byte of option byte block after system reset"]
    #[inline(always)]
    pub fn ob_user(&self) -> ObUserR {
        ObUserR::new(((self.bits >> 8) & 0xff) as u8)
    }
    #[doc = "Bits 16:31 - Store OB_DATA\\[15:0\\]
of option byte block after system reset"]
    #[inline(always)]
    pub fn ob_data(&self) -> ObDataR {
        ObDataR::new(((self.bits >> 16) & 0xffff) as u16)
    }
}
#[doc = "Option byte status register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`obstat::R`](R).  See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct ObstatSpec;
impl crate::RegisterSpec for ObstatSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`obstat::R`](R) reader structure"]
impl crate::Readable for ObstatSpec {}
#[doc = "`reset()` method sets OBSTAT to value 0"]
impl crate::Resettable for ObstatSpec {
    const RESET_VALUE: u32 = 0;
}