efm32pg12_pac/lesense/
scanres.rs

1#[doc = "Reader of register SCANRES"]
2pub type R = crate::R<u32, super::SCANRES>;
3#[doc = "Writer for register SCANRES"]
4pub type W = crate::W<u32, super::SCANRES>;
5#[doc = "Register SCANRES `reset()`'s with value 0"]
6impl crate::ResetValue for super::SCANRES {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SCANRES`"]
14pub type SCANRES_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `SCANRES`"]
16pub struct SCANRES_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SCANRES_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) | ((value as u32) & 0xffff);
24        self.w
25    }
26}
27#[doc = "Reader of field `STEPDIR`"]
28pub type STEPDIR_R = crate::R<u16, u16>;
29#[doc = "Write proxy for field `STEPDIR`"]
30pub struct STEPDIR_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> STEPDIR_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u16) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0xffff << 16)) | (((value as u32) & 0xffff) << 16);
38        self.w
39    }
40}
41impl R {
42    #[doc = "Bits 0:15 - Scan Results"]
43    #[inline(always)]
44    pub fn scanres(&self) -> SCANRES_R {
45        SCANRES_R::new((self.bits & 0xffff) as u16)
46    }
47    #[doc = "Bits 16:31 - Direction of Previous Step Detection"]
48    #[inline(always)]
49    pub fn stepdir(&self) -> STEPDIR_R {
50        STEPDIR_R::new(((self.bits >> 16) & 0xffff) as u16)
51    }
52}
53impl W {
54    #[doc = "Bits 0:15 - Scan Results"]
55    #[inline(always)]
56    pub fn scanres(&mut self) -> SCANRES_W {
57        SCANRES_W { w: self }
58    }
59    #[doc = "Bits 16:31 - Direction of Previous Step Detection"]
60    #[inline(always)]
61    pub fn stepdir(&mut self) -> STEPDIR_W {
62        STEPDIR_W { w: self }
63    }
64}