stm32u5/stm32u585/rtc/
wpr.rs

1///Register `WPR` writer
2pub type W = crate::W<WPRrs>;
3/**Write protection key
4
5Value on reset: 0*/
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum KEY {
10    ///0: Activate write protection (any value that is not the keys)
11    Activate = 0,
12    ///83: Key 2
13    Deactivate2 = 83,
14    ///202: Key 1
15    Deactivate1 = 202,
16}
17impl From<KEY> for u8 {
18    #[inline(always)]
19    fn from(variant: KEY) -> Self {
20        variant as _
21    }
22}
23impl crate::FieldSpec for KEY {
24    type Ux = u8;
25}
26impl crate::IsEnum for KEY {}
27///Field `KEY` writer - Write protection key
28pub type KEY_W<'a, REG> = crate::FieldWriter<'a, REG, 8, KEY>;
29impl<'a, REG> KEY_W<'a, REG>
30where
31    REG: crate::Writable + crate::RegisterSpec,
32    REG::Ux: From<u8>,
33{
34    ///Activate write protection (any value that is not the keys)
35    #[inline(always)]
36    pub fn activate(self) -> &'a mut crate::W<REG> {
37        self.variant(KEY::Activate)
38    }
39    ///Key 2
40    #[inline(always)]
41    pub fn deactivate2(self) -> &'a mut crate::W<REG> {
42        self.variant(KEY::Deactivate2)
43    }
44    ///Key 1
45    #[inline(always)]
46    pub fn deactivate1(self) -> &'a mut crate::W<REG> {
47        self.variant(KEY::Deactivate1)
48    }
49}
50impl core::fmt::Debug for crate::generic::Reg<WPRrs> {
51    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
52        write!(f, "(not readable)")
53    }
54}
55impl W {
56    ///Bits 0:7 - Write protection key
57    #[inline(always)]
58    pub fn key(&mut self) -> KEY_W<WPRrs> {
59        KEY_W::new(self, 0)
60    }
61}
62/**write protection register
63
64You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`wpr::W`](W). See [API](https://docs.rs/svd2rust/#read--modify--write-api).
65
66See register [structure](https://stm32-rs.github.io/stm32-rs/STM32U585.html#RTC:WPR)*/
67pub struct WPRrs;
68impl crate::RegisterSpec for WPRrs {
69    type Ux = u32;
70}
71///`write(|w| ..)` method takes [`wpr::W`](W) writer structure
72impl crate::Writable for WPRrs {
73    type Safety = crate::Unsafe;
74}
75///`reset()` method sets WPR to value 0
76impl crate::Resettable for WPRrs {}