stm32wb_pac/adc/
tr2.rs

1#[doc = "Reader of register TR2"]
2pub type R = crate::R<u32, super::TR2>;
3#[doc = "Writer for register TR2"]
4pub type W = crate::W<u32, super::TR2>;
5#[doc = "Register TR2 `reset()`'s with value 0x0fff_0000"]
6impl crate::ResetValue for super::TR2 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x0fff_0000
11    }
12}
13#[doc = "Reader of field `HT2`"]
14pub type HT2_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `HT2`"]
16pub struct HT2_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> HT2_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 << 16)) | (((value as u32) & 0xff) << 16);
24        self.w
25    }
26}
27#[doc = "Reader of field `LT2`"]
28pub type LT2_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `LT2`"]
30pub struct LT2_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> LT2_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 & !0xff) | ((value as u32) & 0xff);
38        self.w
39    }
40}
41impl R {
42    #[doc = "Bits 16:23 - ADC analog watchdog 2 threshold high"]
43    #[inline(always)]
44    pub fn ht2(&self) -> HT2_R {
45        HT2_R::new(((self.bits >> 16) & 0xff) as u8)
46    }
47    #[doc = "Bits 0:7 - ADC analog watchdog 2 threshold low"]
48    #[inline(always)]
49    pub fn lt2(&self) -> LT2_R {
50        LT2_R::new((self.bits & 0xff) as u8)
51    }
52}
53impl W {
54    #[doc = "Bits 16:23 - ADC analog watchdog 2 threshold high"]
55    #[inline(always)]
56    pub fn ht2(&mut self) -> HT2_W {
57        HT2_W { w: self }
58    }
59    #[doc = "Bits 0:7 - ADC analog watchdog 2 threshold low"]
60    #[inline(always)]
61    pub fn lt2(&mut self) -> LT2_W {
62        LT2_W { w: self }
63    }
64}