max32660_pac/uart0/
thresh_ctrl.rs

1#[doc = "Register `THRESH_CTRL` reader"]
2pub struct R(crate::R<THRESH_CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<THRESH_CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<THRESH_CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<THRESH_CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `THRESH_CTRL` writer"]
17pub struct W(crate::W<THRESH_CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<THRESH_CTRL_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<THRESH_CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<THRESH_CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RX_FIFO_THRESH` reader - RX FIFO Threshold Level.When the RX FIFO reaches this many bytes or higher, UARTn_INFTL.rx_fifo_level is set."]
38pub struct RX_FIFO_THRESH_R(crate::FieldReader<u8, u8>);
39impl RX_FIFO_THRESH_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u8) -> Self {
42        RX_FIFO_THRESH_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for RX_FIFO_THRESH_R {
46    type Target = crate::FieldReader<u8, u8>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `RX_FIFO_THRESH` writer - RX FIFO Threshold Level.When the RX FIFO reaches this many bytes or higher, UARTn_INFTL.rx_fifo_level is set."]
53pub struct RX_FIFO_THRESH_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> RX_FIFO_THRESH_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u8) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x3f) | (value as u32 & 0x3f);
61        self.w
62    }
63}
64#[doc = "Field `TX_FIFO_THRESH` reader - TX FIFO Threshold Level. When the TX FIFO reaches this many bytes or higher, UARTn_INTFL.tx_fifo_level is set."]
65pub struct TX_FIFO_THRESH_R(crate::FieldReader<u8, u8>);
66impl TX_FIFO_THRESH_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: u8) -> Self {
69        TX_FIFO_THRESH_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for TX_FIFO_THRESH_R {
73    type Target = crate::FieldReader<u8, u8>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `TX_FIFO_THRESH` writer - TX FIFO Threshold Level. When the TX FIFO reaches this many bytes or higher, UARTn_INTFL.tx_fifo_level is set."]
80pub struct TX_FIFO_THRESH_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> TX_FIFO_THRESH_W<'a> {
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub unsafe fn bits(self, value: u8) -> &'a mut W {
87        self.w.bits = (self.w.bits & !(0x3f << 8)) | ((value as u32 & 0x3f) << 8);
88        self.w
89    }
90}
91#[doc = "Field `RTS_FIFO_THRESH` reader - RTS threshold control. When the RX FIFO reaches this many bytes or higher, the RTS output signal is deasserted, informing the transmitting UART to stop sending data to this UART."]
92pub struct RTS_FIFO_THRESH_R(crate::FieldReader<u8, u8>);
93impl RTS_FIFO_THRESH_R {
94    #[inline(always)]
95    pub(crate) fn new(bits: u8) -> Self {
96        RTS_FIFO_THRESH_R(crate::FieldReader::new(bits))
97    }
98}
99impl core::ops::Deref for RTS_FIFO_THRESH_R {
100    type Target = crate::FieldReader<u8, u8>;
101    #[inline(always)]
102    fn deref(&self) -> &Self::Target {
103        &self.0
104    }
105}
106#[doc = "Field `RTS_FIFO_THRESH` writer - RTS threshold control. When the RX FIFO reaches this many bytes or higher, the RTS output signal is deasserted, informing the transmitting UART to stop sending data to this UART."]
107pub struct RTS_FIFO_THRESH_W<'a> {
108    w: &'a mut W,
109}
110impl<'a> RTS_FIFO_THRESH_W<'a> {
111    #[doc = r"Writes raw bits to the field"]
112    #[inline(always)]
113    pub unsafe fn bits(self, value: u8) -> &'a mut W {
114        self.w.bits = (self.w.bits & !(0x3f << 16)) | ((value as u32 & 0x3f) << 16);
115        self.w
116    }
117}
118impl R {
119    #[doc = "Bits 0:5 - RX FIFO Threshold Level.When the RX FIFO reaches this many bytes or higher, UARTn_INFTL.rx_fifo_level is set."]
120    #[inline(always)]
121    pub fn rx_fifo_thresh(&self) -> RX_FIFO_THRESH_R {
122        RX_FIFO_THRESH_R::new((self.bits & 0x3f) as u8)
123    }
124    #[doc = "Bits 8:13 - TX FIFO Threshold Level. When the TX FIFO reaches this many bytes or higher, UARTn_INTFL.tx_fifo_level is set."]
125    #[inline(always)]
126    pub fn tx_fifo_thresh(&self) -> TX_FIFO_THRESH_R {
127        TX_FIFO_THRESH_R::new(((self.bits >> 8) & 0x3f) as u8)
128    }
129    #[doc = "Bits 16:21 - RTS threshold control. When the RX FIFO reaches this many bytes or higher, the RTS output signal is deasserted, informing the transmitting UART to stop sending data to this UART."]
130    #[inline(always)]
131    pub fn rts_fifo_thresh(&self) -> RTS_FIFO_THRESH_R {
132        RTS_FIFO_THRESH_R::new(((self.bits >> 16) & 0x3f) as u8)
133    }
134}
135impl W {
136    #[doc = "Bits 0:5 - RX FIFO Threshold Level.When the RX FIFO reaches this many bytes or higher, UARTn_INFTL.rx_fifo_level is set."]
137    #[inline(always)]
138    pub fn rx_fifo_thresh(&mut self) -> RX_FIFO_THRESH_W {
139        RX_FIFO_THRESH_W { w: self }
140    }
141    #[doc = "Bits 8:13 - TX FIFO Threshold Level. When the TX FIFO reaches this many bytes or higher, UARTn_INTFL.tx_fifo_level is set."]
142    #[inline(always)]
143    pub fn tx_fifo_thresh(&mut self) -> TX_FIFO_THRESH_W {
144        TX_FIFO_THRESH_W { w: self }
145    }
146    #[doc = "Bits 16:21 - RTS threshold control. When the RX FIFO reaches this many bytes or higher, the RTS output signal is deasserted, informing the transmitting UART to stop sending data to this UART."]
147    #[inline(always)]
148    pub fn rts_fifo_thresh(&mut self) -> RTS_FIFO_THRESH_W {
149        RTS_FIFO_THRESH_W { w: self }
150    }
151    #[doc = "Writes raw bits to the register."]
152    #[inline(always)]
153    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
154        self.0.bits(bits);
155        self
156    }
157}
158#[doc = "Threshold Control register.\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 [thresh_ctrl](index.html) module"]
159pub struct THRESH_CTRL_SPEC;
160impl crate::RegisterSpec for THRESH_CTRL_SPEC {
161    type Ux = u32;
162}
163#[doc = "`read()` method returns [thresh_ctrl::R](R) reader structure"]
164impl crate::Readable for THRESH_CTRL_SPEC {
165    type Reader = R;
166}
167#[doc = "`write(|w| ..)` method takes [thresh_ctrl::W](W) writer structure"]
168impl crate::Writable for THRESH_CTRL_SPEC {
169    type Writer = W;
170}
171#[doc = "`reset()` method sets THRESH_CTRL to value 0"]
172impl crate::Resettable for THRESH_CTRL_SPEC {
173    #[inline(always)]
174    fn reset_value() -> Self::Ux {
175        0
176    }
177}