esp32c2/uart0/
rs485_conf.rs1#[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", &self.rs485_en())
75 .field("dl0_en", &self.dl0_en())
76 .field("dl1_en", &self.dl1_en())
77 .field("rs485tx_rx_en", &self.rs485tx_rx_en())
78 .field("rs485rxby_tx_en", &self.rs485rxby_tx_en())
79 .field("rs485_rx_dly_num", &self.rs485_rx_dly_num())
80 .field("rs485_tx_dly_num", &self.rs485_tx_dly_num())
81 .finish()
82 }
83}
84impl W {
85 #[doc = "Bit 0 - Set this bit to choose the rs485 mode."]
86 #[inline(always)]
87 pub fn rs485_en(&mut self) -> RS485_EN_W<RS485_CONF_SPEC> {
88 RS485_EN_W::new(self, 0)
89 }
90 #[doc = "Bit 1 - Set this bit to delay the stop bit by 1 bit."]
91 #[inline(always)]
92 pub fn dl0_en(&mut self) -> DL0_EN_W<RS485_CONF_SPEC> {
93 DL0_EN_W::new(self, 1)
94 }
95 #[doc = "Bit 2 - Set this bit to delay the stop bit by 1 bit."]
96 #[inline(always)]
97 pub fn dl1_en(&mut self) -> DL1_EN_W<RS485_CONF_SPEC> {
98 DL1_EN_W::new(self, 2)
99 }
100 #[doc = "Bit 3 - Set this bit to enable receiver could receive data when the transmitter is transmitting data in rs485 mode."]
101 #[inline(always)]
102 pub fn rs485tx_rx_en(&mut self) -> RS485TX_RX_EN_W<RS485_CONF_SPEC> {
103 RS485TX_RX_EN_W::new(self, 3)
104 }
105 #[doc = "Bit 4 - 1'h1: enable rs485 transmitter to send data when rs485 receiver line is busy."]
106 #[inline(always)]
107 pub fn rs485rxby_tx_en(&mut self) -> RS485RXBY_TX_EN_W<RS485_CONF_SPEC> {
108 RS485RXBY_TX_EN_W::new(self, 4)
109 }
110 #[doc = "Bit 5 - This register is used to delay the receiver's internal data signal."]
111 #[inline(always)]
112 pub fn rs485_rx_dly_num(&mut self) -> RS485_RX_DLY_NUM_W<RS485_CONF_SPEC> {
113 RS485_RX_DLY_NUM_W::new(self, 5)
114 }
115 #[doc = "Bits 6:9 - This register is used to delay the transmitter's internal data signal."]
116 #[inline(always)]
117 pub fn rs485_tx_dly_num(&mut self) -> RS485_TX_DLY_NUM_W<RS485_CONF_SPEC> {
118 RS485_TX_DLY_NUM_W::new(self, 6)
119 }
120}
121#[doc = "RS485 mode configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`rs485_conf::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rs485_conf::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
122pub struct RS485_CONF_SPEC;
123impl crate::RegisterSpec for RS485_CONF_SPEC {
124 type Ux = u32;
125}
126#[doc = "`read()` method returns [`rs485_conf::R`](R) reader structure"]
127impl crate::Readable for RS485_CONF_SPEC {}
128#[doc = "`write(|w| ..)` method takes [`rs485_conf::W`](W) writer structure"]
129impl crate::Writable for RS485_CONF_SPEC {
130 type Safety = crate::Unsafe;
131 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
132 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
133}
134#[doc = "`reset()` method sets RS485_CONF to value 0"]
135impl crate::Resettable for RS485_CONF_SPEC {
136 const RESET_VALUE: u32 = 0;
137}