stm32wb_pac/hsem/
r10.rs

1#[doc = "Reader of register R10"]
2pub type R = crate::R<u32, super::R10>;
3#[doc = "Writer for register R10"]
4pub type W = crate::W<u32, super::R10>;
5#[doc = "Register R10 `reset()`'s with value 0"]
6impl crate::ResetValue for super::R10 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `LOCK`"]
14pub type LOCK_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `LOCK`"]
16pub struct LOCK_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> LOCK_W<'a> {
20    #[doc = r"Sets the field bit"]
21    #[inline(always)]
22    pub fn set_bit(self) -> &'a mut W {
23        self.bit(true)
24    }
25    #[doc = r"Clears the field bit"]
26    #[inline(always)]
27    pub fn clear_bit(self) -> &'a mut W {
28        self.bit(false)
29    }
30    #[doc = r"Writes raw bits to the field"]
31    #[inline(always)]
32    pub fn bit(self, value: bool) -> &'a mut W {
33        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
34        self.w
35    }
36}
37#[doc = "Reader of field `COREID`"]
38pub type COREID_R = crate::R<u8, u8>;
39#[doc = "Write proxy for field `COREID`"]
40pub struct COREID_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> COREID_W<'a> {
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub unsafe fn bits(self, value: u8) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
48        self.w
49    }
50}
51#[doc = "Reader of field `PROCID`"]
52pub type PROCID_R = crate::R<u8, u8>;
53#[doc = "Write proxy for field `PROCID`"]
54pub struct PROCID_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> PROCID_W<'a> {
58    #[doc = r"Writes raw bits to the field"]
59    #[inline(always)]
60    pub unsafe fn bits(self, value: u8) -> &'a mut W {
61        self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff);
62        self.w
63    }
64}
65impl R {
66    #[doc = "Bit 31 - lock indication"]
67    #[inline(always)]
68    pub fn lock(&self) -> LOCK_R {
69        LOCK_R::new(((self.bits >> 31) & 0x01) != 0)
70    }
71    #[doc = "Bits 8:11 - Semaphore CoreID"]
72    #[inline(always)]
73    pub fn coreid(&self) -> COREID_R {
74        COREID_R::new(((self.bits >> 8) & 0x0f) as u8)
75    }
76    #[doc = "Bits 0:7 - Semaphore ProcessID"]
77    #[inline(always)]
78    pub fn procid(&self) -> PROCID_R {
79        PROCID_R::new((self.bits & 0xff) as u8)
80    }
81}
82impl W {
83    #[doc = "Bit 31 - lock indication"]
84    #[inline(always)]
85    pub fn lock(&mut self) -> LOCK_W {
86        LOCK_W { w: self }
87    }
88    #[doc = "Bits 8:11 - Semaphore CoreID"]
89    #[inline(always)]
90    pub fn coreid(&mut self) -> COREID_W {
91        COREID_W { w: self }
92    }
93    #[doc = "Bits 0:7 - Semaphore ProcessID"]
94    #[inline(always)]
95    pub fn procid(&mut self) -> PROCID_W {
96        PROCID_W { w: self }
97    }
98}