esp32p4/uart0/
swfc_conf0.rs1#[doc = "Register `SWFC_CONF0` reader"]
2pub type R = crate::R<SWFC_CONF0_SPEC>;
3#[doc = "Register `SWFC_CONF0` writer"]
4pub type W = crate::W<SWFC_CONF0_SPEC>;
5#[doc = "Field `XON_CHAR` reader - This register stores the Xon flow control char."]
6pub type XON_CHAR_R = crate::FieldReader;
7#[doc = "Field `XON_CHAR` writer - This register stores the Xon flow control char."]
8pub type XON_CHAR_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `XOFF_CHAR` reader - This register stores the Xoff flow control char."]
10pub type XOFF_CHAR_R = crate::FieldReader;
11#[doc = "Field `XOFF_CHAR` writer - This register stores the Xoff flow control char."]
12pub type XOFF_CHAR_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `XON_XOFF_STILL_SEND` reader - In software flow control mode, UART Tx is disabled once UART Rx receives XOFF. In this status, UART Tx can not transmit XOFF even the received data number is larger than UART_XOFF_THRESHOLD. Set this bit to enable UART Tx can transmit XON/XOFF when UART Tx is disabled."]
14pub type XON_XOFF_STILL_SEND_R = crate::BitReader;
15#[doc = "Field `XON_XOFF_STILL_SEND` writer - In software flow control mode, UART Tx is disabled once UART Rx receives XOFF. In this status, UART Tx can not transmit XOFF even the received data number is larger than UART_XOFF_THRESHOLD. Set this bit to enable UART Tx can transmit XON/XOFF when UART Tx is disabled."]
16pub type XON_XOFF_STILL_SEND_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `SW_FLOW_CON_EN` reader - Set this bit to enable software flow control. It is used with register sw_xon or sw_xoff."]
18pub type SW_FLOW_CON_EN_R = crate::BitReader;
19#[doc = "Field `SW_FLOW_CON_EN` writer - Set this bit to enable software flow control. It is used with register sw_xon or sw_xoff."]
20pub type SW_FLOW_CON_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `XONOFF_DEL` reader - Set this bit to remove flow control char from the received data."]
22pub type XONOFF_DEL_R = crate::BitReader;
23#[doc = "Field `XONOFF_DEL` writer - Set this bit to remove flow control char from the received data."]
24pub type XONOFF_DEL_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `FORCE_XON` reader - Set this bit to enable the transmitter to go on sending data."]
26pub type FORCE_XON_R = crate::BitReader;
27#[doc = "Field `FORCE_XON` writer - Set this bit to enable the transmitter to go on sending data."]
28pub type FORCE_XON_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `FORCE_XOFF` reader - Set this bit to stop the transmitter from sending data."]
30pub type FORCE_XOFF_R = crate::BitReader;
31#[doc = "Field `FORCE_XOFF` writer - Set this bit to stop the transmitter from sending data."]
32pub type FORCE_XOFF_W<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `SEND_XON` reader - Set this bit to send Xon char. It is cleared by hardware automatically."]
34pub type SEND_XON_R = crate::BitReader;
35#[doc = "Field `SEND_XON` writer - Set this bit to send Xon char. It is cleared by hardware automatically."]
36pub type SEND_XON_W<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `SEND_XOFF` reader - Set this bit to send Xoff char. It is cleared by hardware automatically."]
38pub type SEND_XOFF_R = crate::BitReader;
39#[doc = "Field `SEND_XOFF` writer - Set this bit to send Xoff char. It is cleared by hardware automatically."]
40pub type SEND_XOFF_W<'a, REG> = crate::BitWriter<'a, REG>;
41impl R {
42 #[doc = "Bits 0:7 - This register stores the Xon flow control char."]
43 #[inline(always)]
44 pub fn xon_char(&self) -> XON_CHAR_R {
45 XON_CHAR_R::new((self.bits & 0xff) as u8)
46 }
47 #[doc = "Bits 8:15 - This register stores the Xoff flow control char."]
48 #[inline(always)]
49 pub fn xoff_char(&self) -> XOFF_CHAR_R {
50 XOFF_CHAR_R::new(((self.bits >> 8) & 0xff) as u8)
51 }
52 #[doc = "Bit 16 - In software flow control mode, UART Tx is disabled once UART Rx receives XOFF. In this status, UART Tx can not transmit XOFF even the received data number is larger than UART_XOFF_THRESHOLD. Set this bit to enable UART Tx can transmit XON/XOFF when UART Tx is disabled."]
53 #[inline(always)]
54 pub fn xon_xoff_still_send(&self) -> XON_XOFF_STILL_SEND_R {
55 XON_XOFF_STILL_SEND_R::new(((self.bits >> 16) & 1) != 0)
56 }
57 #[doc = "Bit 17 - Set this bit to enable software flow control. It is used with register sw_xon or sw_xoff."]
58 #[inline(always)]
59 pub fn sw_flow_con_en(&self) -> SW_FLOW_CON_EN_R {
60 SW_FLOW_CON_EN_R::new(((self.bits >> 17) & 1) != 0)
61 }
62 #[doc = "Bit 18 - Set this bit to remove flow control char from the received data."]
63 #[inline(always)]
64 pub fn xonoff_del(&self) -> XONOFF_DEL_R {
65 XONOFF_DEL_R::new(((self.bits >> 18) & 1) != 0)
66 }
67 #[doc = "Bit 19 - Set this bit to enable the transmitter to go on sending data."]
68 #[inline(always)]
69 pub fn force_xon(&self) -> FORCE_XON_R {
70 FORCE_XON_R::new(((self.bits >> 19) & 1) != 0)
71 }
72 #[doc = "Bit 20 - Set this bit to stop the transmitter from sending data."]
73 #[inline(always)]
74 pub fn force_xoff(&self) -> FORCE_XOFF_R {
75 FORCE_XOFF_R::new(((self.bits >> 20) & 1) != 0)
76 }
77 #[doc = "Bit 21 - Set this bit to send Xon char. It is cleared by hardware automatically."]
78 #[inline(always)]
79 pub fn send_xon(&self) -> SEND_XON_R {
80 SEND_XON_R::new(((self.bits >> 21) & 1) != 0)
81 }
82 #[doc = "Bit 22 - Set this bit to send Xoff char. It is cleared by hardware automatically."]
83 #[inline(always)]
84 pub fn send_xoff(&self) -> SEND_XOFF_R {
85 SEND_XOFF_R::new(((self.bits >> 22) & 1) != 0)
86 }
87}
88#[cfg(feature = "impl-register-debug")]
89impl core::fmt::Debug for R {
90 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
91 f.debug_struct("SWFC_CONF0")
92 .field("xon_char", &format_args!("{}", self.xon_char().bits()))
93 .field("xoff_char", &format_args!("{}", self.xoff_char().bits()))
94 .field(
95 "xon_xoff_still_send",
96 &format_args!("{}", self.xon_xoff_still_send().bit()),
97 )
98 .field(
99 "sw_flow_con_en",
100 &format_args!("{}", self.sw_flow_con_en().bit()),
101 )
102 .field("xonoff_del", &format_args!("{}", self.xonoff_del().bit()))
103 .field("force_xon", &format_args!("{}", self.force_xon().bit()))
104 .field("force_xoff", &format_args!("{}", self.force_xoff().bit()))
105 .field("send_xon", &format_args!("{}", self.send_xon().bit()))
106 .field("send_xoff", &format_args!("{}", self.send_xoff().bit()))
107 .finish()
108 }
109}
110#[cfg(feature = "impl-register-debug")]
111impl core::fmt::Debug for crate::generic::Reg<SWFC_CONF0_SPEC> {
112 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
113 core::fmt::Debug::fmt(&self.read(), f)
114 }
115}
116impl W {
117 #[doc = "Bits 0:7 - This register stores the Xon flow control char."]
118 #[inline(always)]
119 #[must_use]
120 pub fn xon_char(&mut self) -> XON_CHAR_W<SWFC_CONF0_SPEC> {
121 XON_CHAR_W::new(self, 0)
122 }
123 #[doc = "Bits 8:15 - This register stores the Xoff flow control char."]
124 #[inline(always)]
125 #[must_use]
126 pub fn xoff_char(&mut self) -> XOFF_CHAR_W<SWFC_CONF0_SPEC> {
127 XOFF_CHAR_W::new(self, 8)
128 }
129 #[doc = "Bit 16 - In software flow control mode, UART Tx is disabled once UART Rx receives XOFF. In this status, UART Tx can not transmit XOFF even the received data number is larger than UART_XOFF_THRESHOLD. Set this bit to enable UART Tx can transmit XON/XOFF when UART Tx is disabled."]
130 #[inline(always)]
131 #[must_use]
132 pub fn xon_xoff_still_send(&mut self) -> XON_XOFF_STILL_SEND_W<SWFC_CONF0_SPEC> {
133 XON_XOFF_STILL_SEND_W::new(self, 16)
134 }
135 #[doc = "Bit 17 - Set this bit to enable software flow control. It is used with register sw_xon or sw_xoff."]
136 #[inline(always)]
137 #[must_use]
138 pub fn sw_flow_con_en(&mut self) -> SW_FLOW_CON_EN_W<SWFC_CONF0_SPEC> {
139 SW_FLOW_CON_EN_W::new(self, 17)
140 }
141 #[doc = "Bit 18 - Set this bit to remove flow control char from the received data."]
142 #[inline(always)]
143 #[must_use]
144 pub fn xonoff_del(&mut self) -> XONOFF_DEL_W<SWFC_CONF0_SPEC> {
145 XONOFF_DEL_W::new(self, 18)
146 }
147 #[doc = "Bit 19 - Set this bit to enable the transmitter to go on sending data."]
148 #[inline(always)]
149 #[must_use]
150 pub fn force_xon(&mut self) -> FORCE_XON_W<SWFC_CONF0_SPEC> {
151 FORCE_XON_W::new(self, 19)
152 }
153 #[doc = "Bit 20 - Set this bit to stop the transmitter from sending data."]
154 #[inline(always)]
155 #[must_use]
156 pub fn force_xoff(&mut self) -> FORCE_XOFF_W<SWFC_CONF0_SPEC> {
157 FORCE_XOFF_W::new(self, 20)
158 }
159 #[doc = "Bit 21 - Set this bit to send Xon char. It is cleared by hardware automatically."]
160 #[inline(always)]
161 #[must_use]
162 pub fn send_xon(&mut self) -> SEND_XON_W<SWFC_CONF0_SPEC> {
163 SEND_XON_W::new(self, 21)
164 }
165 #[doc = "Bit 22 - Set this bit to send Xoff char. It is cleared by hardware automatically."]
166 #[inline(always)]
167 #[must_use]
168 pub fn send_xoff(&mut self) -> SEND_XOFF_W<SWFC_CONF0_SPEC> {
169 SEND_XOFF_W::new(self, 22)
170 }
171}
172#[doc = "Software flow-control character configuration\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`swfc_conf0::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 [`swfc_conf0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
173pub struct SWFC_CONF0_SPEC;
174impl crate::RegisterSpec for SWFC_CONF0_SPEC {
175 type Ux = u32;
176}
177#[doc = "`read()` method returns [`swfc_conf0::R`](R) reader structure"]
178impl crate::Readable for SWFC_CONF0_SPEC {}
179#[doc = "`write(|w| ..)` method takes [`swfc_conf0::W`](W) writer structure"]
180impl crate::Writable for SWFC_CONF0_SPEC {
181 type Safety = crate::Unsafe;
182 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
183 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
184}
185#[doc = "`reset()` method sets SWFC_CONF0 to value 0x1311"]
186impl crate::Resettable for SWFC_CONF0_SPEC {
187 const RESET_VALUE: u32 = 0x1311;
188}