bl808_pac/i2c/
fifo_config_1.rs

1#[doc = "Register `fifo_config_1` reader"]
2pub struct R(crate::R<FIFO_CONFIG_1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FIFO_CONFIG_1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FIFO_CONFIG_1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FIFO_CONFIG_1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `fifo_config_1` writer"]
17pub struct W(crate::W<FIFO_CONFIG_1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FIFO_CONFIG_1_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<FIFO_CONFIG_1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FIFO_CONFIG_1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `transmit_count` reader - Count of available data in transmit FIFO"]
38pub type TRANSMIT_COUNT_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `receive_count` reader - Count of available data in receive FIFO"]
40pub type RECEIVE_COUNT_R = crate::FieldReader<u8, u8>;
41#[doc = "Field `transmit_threshold` reader - Transmit FIFO threshold\n\n DMA request will not be asserted if `transmit_available` is less than this value"]
42pub type TRANSMIT_THRESHOLD_R = crate::BitReader<bool>;
43#[doc = "Field `transmit_threshold` writer - Transmit FIFO threshold\n\n DMA request will not be asserted if `transmit_available` is less than this value"]
44pub type TRANSMIT_THRESHOLD_W<'a, const O: u8> =
45    crate::BitWriter<'a, u32, FIFO_CONFIG_1_SPEC, bool, O>;
46#[doc = "Field `receive_threshold` reader - Receive FIFO threshold\n\n DMA request will not be asserted if `receive_available` is less than this value"]
47pub type RECEIVE_THRESHOLD_R = crate::BitReader<bool>;
48#[doc = "Field `receive_threshold` writer - Receive FIFO threshold\n\n DMA request will not be asserted if `receive_available` is less than this value"]
49pub type RECEIVE_THRESHOLD_W<'a, const O: u8> =
50    crate::BitWriter<'a, u32, FIFO_CONFIG_1_SPEC, bool, O>;
51impl R {
52    #[doc = "Bits 0:1 - Count of available data in transmit FIFO"]
53    #[inline(always)]
54    pub fn transmit_count(&self) -> TRANSMIT_COUNT_R {
55        TRANSMIT_COUNT_R::new((self.bits & 3) as u8)
56    }
57    #[doc = "Bits 8:9 - Count of available data in receive FIFO"]
58    #[inline(always)]
59    pub fn receive_count(&self) -> RECEIVE_COUNT_R {
60        RECEIVE_COUNT_R::new(((self.bits >> 8) & 3) as u8)
61    }
62    #[doc = "Bit 16 - Transmit FIFO threshold\n\n DMA request will not be asserted if `transmit_available` is less than this value"]
63    #[inline(always)]
64    pub fn transmit_threshold(&self) -> TRANSMIT_THRESHOLD_R {
65        TRANSMIT_THRESHOLD_R::new(((self.bits >> 16) & 1) != 0)
66    }
67    #[doc = "Bit 24 - Receive FIFO threshold\n\n DMA request will not be asserted if `receive_available` is less than this value"]
68    #[inline(always)]
69    pub fn receive_threshold(&self) -> RECEIVE_THRESHOLD_R {
70        RECEIVE_THRESHOLD_R::new(((self.bits >> 24) & 1) != 0)
71    }
72}
73impl W {
74    #[doc = "Bit 16 - Transmit FIFO threshold\n\n DMA request will not be asserted if `transmit_available` is less than this value"]
75    #[inline(always)]
76    pub fn transmit_threshold(&mut self) -> TRANSMIT_THRESHOLD_W<16> {
77        TRANSMIT_THRESHOLD_W::new(self)
78    }
79    #[doc = "Bit 24 - Receive FIFO threshold\n\n DMA request will not be asserted if `receive_available` is less than this value"]
80    #[inline(always)]
81    pub fn receive_threshold(&mut self) -> RECEIVE_THRESHOLD_W<24> {
82        RECEIVE_THRESHOLD_W::new(self)
83    }
84    #[doc = "Writes raw bits to the register."]
85    #[inline(always)]
86    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
87        self.0.bits(bits);
88        self
89    }
90}
91#[doc = "FIFO configuration register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fifo_config_1](index.html) module"]
92pub struct FIFO_CONFIG_1_SPEC;
93impl crate::RegisterSpec for FIFO_CONFIG_1_SPEC {
94    type Ux = u32;
95}
96#[doc = "`read()` method returns [fifo_config_1::R](R) reader structure"]
97impl crate::Readable for FIFO_CONFIG_1_SPEC {
98    type Reader = R;
99}
100#[doc = "`write(|w| ..)` method takes [fifo_config_1::W](W) writer structure"]
101impl crate::Writable for FIFO_CONFIG_1_SPEC {
102    type Writer = W;
103}
104#[doc = "`reset()` method sets fifo_config_1 to value 0x02"]
105impl crate::Resettable for FIFO_CONFIG_1_SPEC {
106    #[inline(always)]
107    fn reset_value() -> Self::Ux {
108        0x02
109    }
110}