stm32wb_pac/hsem/
cr.rs

1#[doc = "Reader of register CR"]
2pub type R = crate::R<u32, super::CR>;
3#[doc = "Writer for register CR"]
4pub type W = crate::W<u32, super::CR>;
5#[doc = "Register CR `reset()`'s with value 0"]
6impl crate::ResetValue for super::CR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `KEY`"]
14pub type KEY_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `KEY`"]
16pub struct KEY_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> KEY_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u16) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0xffff << 16)) | (((value as u32) & 0xffff) << 16);
24        self.w
25    }
26}
27#[doc = "Reader of field `COREID`"]
28pub type COREID_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `COREID`"]
30pub struct COREID_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> COREID_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
38        self.w
39    }
40}
41impl R {
42    #[doc = "Bits 16:31 - Semaphore clear Key"]
43    #[inline(always)]
44    pub fn key(&self) -> KEY_R {
45        KEY_R::new(((self.bits >> 16) & 0xffff) as u16)
46    }
47    #[doc = "Bits 8:11 - CoreID of semaphore to be cleared"]
48    #[inline(always)]
49    pub fn coreid(&self) -> COREID_R {
50        COREID_R::new(((self.bits >> 8) & 0x0f) as u8)
51    }
52}
53impl W {
54    #[doc = "Bits 16:31 - Semaphore clear Key"]
55    #[inline(always)]
56    pub fn key(&mut self) -> KEY_W {
57        KEY_W { w: self }
58    }
59    #[doc = "Bits 8:11 - CoreID of semaphore to be cleared"]
60    #[inline(always)]
61    pub fn coreid(&mut self) -> COREID_W {
62        COREID_W { w: self }
63    }
64}