esp32s2/uart0/
autobaud.rs

1#[doc = "Register `AUTOBAUD` reader"]
2pub type R = crate::R<AUTOBAUD_SPEC>;
3#[doc = "Register `AUTOBAUD` writer"]
4pub type W = crate::W<AUTOBAUD_SPEC>;
5#[doc = "Field `EN` reader - This is the enable bit for baud rate detection."]
6pub type EN_R = crate::BitReader;
7#[doc = "Field `EN` writer - This is the enable bit for baud rate detection."]
8pub type EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `GLITCH_FILT` reader - When input pulse width is lower than this value, the pulse is ignored. This register is used in autobaud detection."]
10pub type GLITCH_FILT_R = crate::FieldReader;
11#[doc = "Field `GLITCH_FILT` writer - When input pulse width is lower than this value, the pulse is ignored. This register is used in autobaud detection."]
12pub type GLITCH_FILT_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13impl R {
14    #[doc = "Bit 0 - This is the enable bit for baud rate detection."]
15    #[inline(always)]
16    pub fn en(&self) -> EN_R {
17        EN_R::new((self.bits & 1) != 0)
18    }
19    #[doc = "Bits 8:15 - When input pulse width is lower than this value, the pulse is ignored. This register is used in autobaud detection."]
20    #[inline(always)]
21    pub fn glitch_filt(&self) -> GLITCH_FILT_R {
22        GLITCH_FILT_R::new(((self.bits >> 8) & 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("AUTOBAUD")
29            .field("en", &self.en())
30            .field("glitch_filt", &self.glitch_filt())
31            .finish()
32    }
33}
34impl W {
35    #[doc = "Bit 0 - This is the enable bit for baud rate detection."]
36    #[inline(always)]
37    pub fn en(&mut self) -> EN_W<AUTOBAUD_SPEC> {
38        EN_W::new(self, 0)
39    }
40    #[doc = "Bits 8:15 - When input pulse width is lower than this value, the pulse is ignored. This register is used in autobaud detection."]
41    #[inline(always)]
42    pub fn glitch_filt(&mut self) -> GLITCH_FILT_W<AUTOBAUD_SPEC> {
43        GLITCH_FILT_W::new(self, 8)
44    }
45}
46#[doc = "Autobaud configuration register\n\nYou can [`read`](crate::Reg::read) this register and get [`autobaud::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`autobaud::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
47pub struct AUTOBAUD_SPEC;
48impl crate::RegisterSpec for AUTOBAUD_SPEC {
49    type Ux = u32;
50}
51#[doc = "`read()` method returns [`autobaud::R`](R) reader structure"]
52impl crate::Readable for AUTOBAUD_SPEC {}
53#[doc = "`write(|w| ..)` method takes [`autobaud::W`](W) writer structure"]
54impl crate::Writable for AUTOBAUD_SPEC {
55    type Safety = crate::Unsafe;
56}
57#[doc = "`reset()` method sets AUTOBAUD to value 0x1000"]
58impl crate::Resettable for AUTOBAUD_SPEC {
59    const RESET_VALUE: u32 = 0x1000;
60}