d1_pac/i2s_pcm/
i2s_pcm_fsta.rs

1#[doc = "Register `i2s_pcm_fsta` reader"]
2pub type R = crate::R<I2S_PCM_FSTA_SPEC>;
3#[doc = "Register `i2s_pcm_fsta` writer"]
4pub type W = crate::W<I2S_PCM_FSTA_SPEC>;
5#[doc = "Field `rxa_cnt` reader - RXFIFO Available sample word counter"]
6pub type RXA_CNT_R = crate::FieldReader;
7#[doc = "Field `rxa` reader - RXFIFO Available"]
8pub type RXA_R = crate::BitReader<RXA_A>;
9#[doc = "RXFIFO Available\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum RXA_A {
12    #[doc = "0: No Available data in RXFIFO"]
13    NO_AVAILABLE = 0,
14    #[doc = "1: More than one sample in RXFIFO (&lt;= 1 Word)"]
15    AVAILABLE = 1,
16}
17impl From<RXA_A> for bool {
18    #[inline(always)]
19    fn from(variant: RXA_A) -> Self {
20        variant as u8 != 0
21    }
22}
23impl RXA_R {
24    #[doc = "Get enumerated values variant"]
25    #[inline(always)]
26    pub const fn variant(&self) -> RXA_A {
27        match self.bits {
28            false => RXA_A::NO_AVAILABLE,
29            true => RXA_A::AVAILABLE,
30        }
31    }
32    #[doc = "No Available data in RXFIFO"]
33    #[inline(always)]
34    pub fn is_no_available(&self) -> bool {
35        *self == RXA_A::NO_AVAILABLE
36    }
37    #[doc = "More than one sample in RXFIFO (&lt;= 1 Word)"]
38    #[inline(always)]
39    pub fn is_available(&self) -> bool {
40        *self == RXA_A::AVAILABLE
41    }
42}
43#[doc = "Field `txe_cnt` reader - TXFIFO Empty space word counter"]
44pub type TXE_CNT_R = crate::FieldReader;
45#[doc = "Field `txe` reader - TXFIFO Empty"]
46pub type TXE_R = crate::BitReader<TXE_A>;
47#[doc = "TXFIFO Empty\n\nValue on reset: 0"]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum TXE_A {
50    #[doc = "0: No room for new sample in TXFIFO"]
51    NOT_EMPTY = 0,
52    #[doc = "1: More than one sample in RXFIFO (>= 1 Word)"]
53    EMPTY = 1,
54}
55impl From<TXE_A> for bool {
56    #[inline(always)]
57    fn from(variant: TXE_A) -> Self {
58        variant as u8 != 0
59    }
60}
61impl TXE_R {
62    #[doc = "Get enumerated values variant"]
63    #[inline(always)]
64    pub const fn variant(&self) -> TXE_A {
65        match self.bits {
66            false => TXE_A::NOT_EMPTY,
67            true => TXE_A::EMPTY,
68        }
69    }
70    #[doc = "No room for new sample in TXFIFO"]
71    #[inline(always)]
72    pub fn is_not_empty(&self) -> bool {
73        *self == TXE_A::NOT_EMPTY
74    }
75    #[doc = "More than one sample in RXFIFO (>= 1 Word)"]
76    #[inline(always)]
77    pub fn is_empty(&self) -> bool {
78        *self == TXE_A::EMPTY
79    }
80}
81impl R {
82    #[doc = "Bits 0:6 - RXFIFO Available sample word counter"]
83    #[inline(always)]
84    pub fn rxa_cnt(&self) -> RXA_CNT_R {
85        RXA_CNT_R::new((self.bits & 0x7f) as u8)
86    }
87    #[doc = "Bit 8 - RXFIFO Available"]
88    #[inline(always)]
89    pub fn rxa(&self) -> RXA_R {
90        RXA_R::new(((self.bits >> 8) & 1) != 0)
91    }
92    #[doc = "Bits 16:23 - TXFIFO Empty space word counter"]
93    #[inline(always)]
94    pub fn txe_cnt(&self) -> TXE_CNT_R {
95        TXE_CNT_R::new(((self.bits >> 16) & 0xff) as u8)
96    }
97    #[doc = "Bit 28 - TXFIFO Empty"]
98    #[inline(always)]
99    pub fn txe(&self) -> TXE_R {
100        TXE_R::new(((self.bits >> 28) & 1) != 0)
101    }
102}
103impl W {
104    #[doc = r" Writes raw bits to the register."]
105    #[doc = r""]
106    #[doc = r" # Safety"]
107    #[doc = r""]
108    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
109    #[inline(always)]
110    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
111        self.bits = bits;
112        self
113    }
114}
115#[doc = "I2S/PCM FIFO Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`i2s_pcm_fsta::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`i2s_pcm_fsta::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
116pub struct I2S_PCM_FSTA_SPEC;
117impl crate::RegisterSpec for I2S_PCM_FSTA_SPEC {
118    type Ux = u32;
119}
120#[doc = "`read()` method returns [`i2s_pcm_fsta::R`](R) reader structure"]
121impl crate::Readable for I2S_PCM_FSTA_SPEC {}
122#[doc = "`write(|w| ..)` method takes [`i2s_pcm_fsta::W`](W) writer structure"]
123impl crate::Writable for I2S_PCM_FSTA_SPEC {
124    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
125    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
126}
127#[doc = "`reset()` method sets i2s_pcm_fsta to value 0"]
128impl crate::Resettable for I2S_PCM_FSTA_SPEC {
129    const RESET_VALUE: Self::Ux = 0;
130}