esp32c2/uart0/
swfc_conf0.rs

1#[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 `XOFF_THRESHOLD` reader - When the data amount in Rx-FIFO is more than this register value with uart_sw_flow_con_en set to 1, it will send a Xoff char."]
6pub type XOFF_THRESHOLD_R = crate::FieldReader<u16>;
7#[doc = "Field `XOFF_THRESHOLD` writer - When the data amount in Rx-FIFO is more than this register value with uart_sw_flow_con_en set to 1, it will send a Xoff char."]
8pub type XOFF_THRESHOLD_W<'a, REG> = crate::FieldWriter<'a, REG, 9, u16>;
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>;
13impl R {
14    #[doc = "Bits 0:8 - When the data amount in Rx-FIFO is more than this register value with uart_sw_flow_con_en set to 1, it will send a Xoff char."]
15    #[inline(always)]
16    pub fn xoff_threshold(&self) -> XOFF_THRESHOLD_R {
17        XOFF_THRESHOLD_R::new((self.bits & 0x01ff) as u16)
18    }
19    #[doc = "Bits 9:16 - This register stores the Xoff flow control char."]
20    #[inline(always)]
21    pub fn xoff_char(&self) -> XOFF_CHAR_R {
22        XOFF_CHAR_R::new(((self.bits >> 9) & 0xff) as u8)
23    }
24}
25#[cfg(feature = "impl-register-debug")]
26impl core::fmt::Debug for R {
27    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
28        f.debug_struct("SWFC_CONF0")
29            .field("xoff_threshold", &self.xoff_threshold())
30            .field("xoff_char", &self.xoff_char())
31            .finish()
32    }
33}
34impl W {
35    #[doc = "Bits 0:8 - When the data amount in Rx-FIFO is more than this register value with uart_sw_flow_con_en set to 1, it will send a Xoff char."]
36    #[inline(always)]
37    pub fn xoff_threshold(&mut self) -> XOFF_THRESHOLD_W<SWFC_CONF0_SPEC> {
38        XOFF_THRESHOLD_W::new(self, 0)
39    }
40    #[doc = "Bits 9:16 - This register stores the Xoff flow control char."]
41    #[inline(always)]
42    pub fn xoff_char(&mut self) -> XOFF_CHAR_W<SWFC_CONF0_SPEC> {
43        XOFF_CHAR_W::new(self, 9)
44    }
45}
46#[doc = "Software flow-control character configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`swfc_conf0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`swfc_conf0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
47pub struct SWFC_CONF0_SPEC;
48impl crate::RegisterSpec for SWFC_CONF0_SPEC {
49    type Ux = u32;
50}
51#[doc = "`read()` method returns [`swfc_conf0::R`](R) reader structure"]
52impl crate::Readable for SWFC_CONF0_SPEC {}
53#[doc = "`write(|w| ..)` method takes [`swfc_conf0::W`](W) writer structure"]
54impl crate::Writable for SWFC_CONF0_SPEC {
55    type Safety = crate::Unsafe;
56    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
57    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
58}
59#[doc = "`reset()` method sets SWFC_CONF0 to value 0x26e0"]
60impl crate::Resettable for SWFC_CONF0_SPEC {
61    const RESET_VALUE: u32 = 0x26e0;
62}