efm32pg12_pac/csen/
ema.rs

1#[doc = "Reader of register EMA"]
2pub type R = crate::R<u32, super::EMA>;
3#[doc = "Writer for register EMA"]
4pub type W = crate::W<u32, super::EMA>;
5#[doc = "Register EMA `reset()`'s with value 0"]
6impl crate::ResetValue for super::EMA {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `EMA`"]
14pub type EMA_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `EMA`"]
16pub struct EMA_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> EMA_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x003f_ffff) | ((value as u32) & 0x003f_ffff);
24        self.w
25    }
26}
27impl R {
28    #[doc = "Bits 0:21 - Calculated Exponential Moving Average"]
29    #[inline(always)]
30    pub fn ema(&self) -> EMA_R {
31        EMA_R::new((self.bits & 0x003f_ffff) as u32)
32    }
33}
34impl W {
35    #[doc = "Bits 0:21 - Calculated Exponential Moving Average"]
36    #[inline(always)]
37    pub fn ema(&mut self) -> EMA_W {
38        EMA_W { w: self }
39    }
40}