esp32p4/uart0/
rs485_conf.rs

1#[doc = "Register `RS485_CONF` reader"]
2pub type R = crate::R<RS485_CONF_SPEC>;
3#[doc = "Register `RS485_CONF` writer"]
4pub type W = crate::W<RS485_CONF_SPEC>;
5#[doc = "Field `RS485_EN` reader - Set this bit to choose the rs485 mode."]
6pub type RS485_EN_R = crate::BitReader;
7#[doc = "Field `RS485_EN` writer - Set this bit to choose the rs485 mode."]
8pub type RS485_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `DL0_EN` reader - Set this bit to delay the stop bit by 1 bit."]
10pub type DL0_EN_R = crate::BitReader;
11#[doc = "Field `DL0_EN` writer - Set this bit to delay the stop bit by 1 bit."]
12pub type DL0_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `DL1_EN` reader - Set this bit to delay the stop bit by 1 bit."]
14pub type DL1_EN_R = crate::BitReader;
15#[doc = "Field `DL1_EN` writer - Set this bit to delay the stop bit by 1 bit."]
16pub type DL1_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `RS485TX_RX_EN` reader - Set this bit to enable receiver could receive data when the transmitter is transmitting data in rs485 mode."]
18pub type RS485TX_RX_EN_R = crate::BitReader;
19#[doc = "Field `RS485TX_RX_EN` writer - Set this bit to enable receiver could receive data when the transmitter is transmitting data in rs485 mode."]
20pub type RS485TX_RX_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `RS485RXBY_TX_EN` reader - 1'h1: enable rs485 transmitter to send data when rs485 receiver line is busy."]
22pub type RS485RXBY_TX_EN_R = crate::BitReader;
23#[doc = "Field `RS485RXBY_TX_EN` writer - 1'h1: enable rs485 transmitter to send data when rs485 receiver line is busy."]
24pub type RS485RXBY_TX_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `RS485_RX_DLY_NUM` reader - This register is used to delay the receiver's internal data signal."]
26pub type RS485_RX_DLY_NUM_R = crate::BitReader;
27#[doc = "Field `RS485_RX_DLY_NUM` writer - This register is used to delay the receiver's internal data signal."]
28pub type RS485_RX_DLY_NUM_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `RS485_TX_DLY_NUM` reader - This register is used to delay the transmitter's internal data signal."]
30pub type RS485_TX_DLY_NUM_R = crate::FieldReader;
31#[doc = "Field `RS485_TX_DLY_NUM` writer - This register is used to delay the transmitter's internal data signal."]
32pub type RS485_TX_DLY_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
33impl R {
34    #[doc = "Bit 0 - Set this bit to choose the rs485 mode."]
35    #[inline(always)]
36    pub fn rs485_en(&self) -> RS485_EN_R {
37        RS485_EN_R::new((self.bits & 1) != 0)
38    }
39    #[doc = "Bit 1 - Set this bit to delay the stop bit by 1 bit."]
40    #[inline(always)]
41    pub fn dl0_en(&self) -> DL0_EN_R {
42        DL0_EN_R::new(((self.bits >> 1) & 1) != 0)
43    }
44    #[doc = "Bit 2 - Set this bit to delay the stop bit by 1 bit."]
45    #[inline(always)]
46    pub fn dl1_en(&self) -> DL1_EN_R {
47        DL1_EN_R::new(((self.bits >> 2) & 1) != 0)
48    }
49    #[doc = "Bit 3 - Set this bit to enable receiver could receive data when the transmitter is transmitting data in rs485 mode."]
50    #[inline(always)]
51    pub fn rs485tx_rx_en(&self) -> RS485TX_RX_EN_R {
52        RS485TX_RX_EN_R::new(((self.bits >> 3) & 1) != 0)
53    }
54    #[doc = "Bit 4 - 1'h1: enable rs485 transmitter to send data when rs485 receiver line is busy."]
55    #[inline(always)]
56    pub fn rs485rxby_tx_en(&self) -> RS485RXBY_TX_EN_R {
57        RS485RXBY_TX_EN_R::new(((self.bits >> 4) & 1) != 0)
58    }
59    #[doc = "Bit 5 - This register is used to delay the receiver's internal data signal."]
60    #[inline(always)]
61    pub fn rs485_rx_dly_num(&self) -> RS485_RX_DLY_NUM_R {
62        RS485_RX_DLY_NUM_R::new(((self.bits >> 5) & 1) != 0)
63    }
64    #[doc = "Bits 6:9 - This register is used to delay the transmitter's internal data signal."]
65    #[inline(always)]
66    pub fn rs485_tx_dly_num(&self) -> RS485_TX_DLY_NUM_R {
67        RS485_TX_DLY_NUM_R::new(((self.bits >> 6) & 0x0f) as u8)
68    }
69}
70#[cfg(feature = "impl-register-debug")]
71impl core::fmt::Debug for R {
72    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
73        f.debug_struct("RS485_CONF")
74            .field("rs485_en", &format_args!("{}", self.rs485_en().bit()))
75            .field("dl0_en", &format_args!("{}", self.dl0_en().bit()))
76            .field("dl1_en", &format_args!("{}", self.dl1_en().bit()))
77            .field(
78                "rs485tx_rx_en",
79                &format_args!("{}", self.rs485tx_rx_en().bit()),
80            )
81            .field(
82                "rs485rxby_tx_en",
83                &format_args!("{}", self.rs485rxby_tx_en().bit()),
84            )
85            .field(
86                "rs485_rx_dly_num",
87                &format_args!("{}", self.rs485_rx_dly_num().bit()),
88            )
89            .field(
90                "rs485_tx_dly_num",
91                &format_args!("{}", self.rs485_tx_dly_num().bits()),
92            )
93            .finish()
94    }
95}
96#[cfg(feature = "impl-register-debug")]
97impl core::fmt::Debug for crate::generic::Reg<RS485_CONF_SPEC> {
98    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
99        core::fmt::Debug::fmt(&self.read(), f)
100    }
101}
102impl W {
103    #[doc = "Bit 0 - Set this bit to choose the rs485 mode."]
104    #[inline(always)]
105    #[must_use]
106    pub fn rs485_en(&mut self) -> RS485_EN_W<RS485_CONF_SPEC> {
107        RS485_EN_W::new(self, 0)
108    }
109    #[doc = "Bit 1 - Set this bit to delay the stop bit by 1 bit."]
110    #[inline(always)]
111    #[must_use]
112    pub fn dl0_en(&mut self) -> DL0_EN_W<RS485_CONF_SPEC> {
113        DL0_EN_W::new(self, 1)
114    }
115    #[doc = "Bit 2 - Set this bit to delay the stop bit by 1 bit."]
116    #[inline(always)]
117    #[must_use]
118    pub fn dl1_en(&mut self) -> DL1_EN_W<RS485_CONF_SPEC> {
119        DL1_EN_W::new(self, 2)
120    }
121    #[doc = "Bit 3 - Set this bit to enable receiver could receive data when the transmitter is transmitting data in rs485 mode."]
122    #[inline(always)]
123    #[must_use]
124    pub fn rs485tx_rx_en(&mut self) -> RS485TX_RX_EN_W<RS485_CONF_SPEC> {
125        RS485TX_RX_EN_W::new(self, 3)
126    }
127    #[doc = "Bit 4 - 1'h1: enable rs485 transmitter to send data when rs485 receiver line is busy."]
128    #[inline(always)]
129    #[must_use]
130    pub fn rs485rxby_tx_en(&mut self) -> RS485RXBY_TX_EN_W<RS485_CONF_SPEC> {
131        RS485RXBY_TX_EN_W::new(self, 4)
132    }
133    #[doc = "Bit 5 - This register is used to delay the receiver's internal data signal."]
134    #[inline(always)]
135    #[must_use]
136    pub fn rs485_rx_dly_num(&mut self) -> RS485_RX_DLY_NUM_W<RS485_CONF_SPEC> {
137        RS485_RX_DLY_NUM_W::new(self, 5)
138    }
139    #[doc = "Bits 6:9 - This register is used to delay the transmitter's internal data signal."]
140    #[inline(always)]
141    #[must_use]
142    pub fn rs485_tx_dly_num(&mut self) -> RS485_TX_DLY_NUM_W<RS485_CONF_SPEC> {
143        RS485_TX_DLY_NUM_W::new(self, 6)
144    }
145}
146#[doc = "RS485 mode configuration\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`rs485_conf::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 [`rs485_conf::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
147pub struct RS485_CONF_SPEC;
148impl crate::RegisterSpec for RS485_CONF_SPEC {
149    type Ux = u32;
150}
151#[doc = "`read()` method returns [`rs485_conf::R`](R) reader structure"]
152impl crate::Readable for RS485_CONF_SPEC {}
153#[doc = "`write(|w| ..)` method takes [`rs485_conf::W`](W) writer structure"]
154impl crate::Writable for RS485_CONF_SPEC {
155    type Safety = crate::Unsafe;
156    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
157    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
158}
159#[doc = "`reset()` method sets RS485_CONF to value 0"]
160impl crate::Resettable for RS485_CONF_SPEC {
161    const RESET_VALUE: u32 = 0;
162}