d1_pac/twi/
twi_drv_dma_cfg.rs

1#[doc = "Register `twi_drv_dma_cfg` reader"]
2pub type R = crate::R<TWI_DRV_DMA_CFG_SPEC>;
3#[doc = "Register `twi_drv_dma_cfg` writer"]
4pub type W = crate::W<TWI_DRV_DMA_CFG_SPEC>;
5#[doc = "Field `tx_trig` reader - "]
6pub type TX_TRIG_R = crate::FieldReader;
7#[doc = "Field `tx_trig` writer - "]
8pub type TX_TRIG_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
9#[doc = "Field `dma_tx_en` reader - "]
10pub type DMA_TX_EN_R = crate::BitReader;
11#[doc = "Field `dma_tx_en` writer - "]
12pub type DMA_TX_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `rx_trig` reader - "]
14pub type RX_TRIG_R = crate::FieldReader;
15#[doc = "Field `rx_trig` writer - "]
16pub type RX_TRIG_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
17#[doc = "Field `dma_rx_en` reader - "]
18pub type DMA_RX_EN_R = crate::FieldReader;
19#[doc = "Field `dma_rx_en` writer - "]
20pub type DMA_RX_EN_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
21impl R {
22    #[doc = "Bits 0:5"]
23    #[inline(always)]
24    pub fn tx_trig(&self) -> TX_TRIG_R {
25        TX_TRIG_R::new((self.bits & 0x3f) as u8)
26    }
27    #[doc = "Bit 8"]
28    #[inline(always)]
29    pub fn dma_tx_en(&self) -> DMA_TX_EN_R {
30        DMA_TX_EN_R::new(((self.bits >> 8) & 1) != 0)
31    }
32    #[doc = "Bits 16:21"]
33    #[inline(always)]
34    pub fn rx_trig(&self) -> RX_TRIG_R {
35        RX_TRIG_R::new(((self.bits >> 16) & 0x3f) as u8)
36    }
37    #[doc = "Bits 23:24"]
38    #[inline(always)]
39    pub fn dma_rx_en(&self) -> DMA_RX_EN_R {
40        DMA_RX_EN_R::new(((self.bits >> 23) & 3) as u8)
41    }
42}
43impl W {
44    #[doc = "Bits 0:5"]
45    #[inline(always)]
46    #[must_use]
47    pub fn tx_trig(&mut self) -> TX_TRIG_W<TWI_DRV_DMA_CFG_SPEC> {
48        TX_TRIG_W::new(self, 0)
49    }
50    #[doc = "Bit 8"]
51    #[inline(always)]
52    #[must_use]
53    pub fn dma_tx_en(&mut self) -> DMA_TX_EN_W<TWI_DRV_DMA_CFG_SPEC> {
54        DMA_TX_EN_W::new(self, 8)
55    }
56    #[doc = "Bits 16:21"]
57    #[inline(always)]
58    #[must_use]
59    pub fn rx_trig(&mut self) -> RX_TRIG_W<TWI_DRV_DMA_CFG_SPEC> {
60        RX_TRIG_W::new(self, 16)
61    }
62    #[doc = "Bits 23:24"]
63    #[inline(always)]
64    #[must_use]
65    pub fn dma_rx_en(&mut self) -> DMA_RX_EN_W<TWI_DRV_DMA_CFG_SPEC> {
66        DMA_RX_EN_W::new(self, 23)
67    }
68    #[doc = r" Writes raw bits to the register."]
69    #[doc = r""]
70    #[doc = r" # Safety"]
71    #[doc = r""]
72    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
73    #[inline(always)]
74    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
75        self.bits = bits;
76        self
77    }
78}
79#[doc = "TWI_DRV DMA Configure Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`twi_drv_dma_cfg::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 [`twi_drv_dma_cfg::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct TWI_DRV_DMA_CFG_SPEC;
81impl crate::RegisterSpec for TWI_DRV_DMA_CFG_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`twi_drv_dma_cfg::R`](R) reader structure"]
85impl crate::Readable for TWI_DRV_DMA_CFG_SPEC {}
86#[doc = "`write(|w| ..)` method takes [`twi_drv_dma_cfg::W`](W) writer structure"]
87impl crate::Writable for TWI_DRV_DMA_CFG_SPEC {
88    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
89    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
90}
91#[doc = "`reset()` method sets twi_drv_dma_cfg to value 0"]
92impl crate::Resettable for TWI_DRV_DMA_CFG_SPEC {
93    const RESET_VALUE: Self::Ux = 0;
94}