esp32p4/usb_device/
chip_rst.rs

1#[doc = "Register `CHIP_RST` reader"]
2pub type R = crate::R<CHIP_RST_SPEC>;
3#[doc = "Register `CHIP_RST` writer"]
4pub type W = crate::W<CHIP_RST_SPEC>;
5#[doc = "Field `RTS` reader - 1: Chip reset is detected from usb serial channel. Software write 1 to clear it."]
6pub type RTS_R = crate::BitReader;
7#[doc = "Field `DTR` reader - 1: Chip reset is detected from usb jtag channel. Software write 1 to clear it."]
8pub type DTR_R = crate::BitReader;
9#[doc = "Field `USB_UART_CHIP_RST_DIS` reader - Set this bit to disable chip reset from usb serial channel to reset chip."]
10pub type USB_UART_CHIP_RST_DIS_R = crate::BitReader;
11#[doc = "Field `USB_UART_CHIP_RST_DIS` writer - Set this bit to disable chip reset from usb serial channel to reset chip."]
12pub type USB_UART_CHIP_RST_DIS_W<'a, REG> = crate::BitWriter<'a, REG>;
13impl R {
14    #[doc = "Bit 0 - 1: Chip reset is detected from usb serial channel. Software write 1 to clear it."]
15    #[inline(always)]
16    pub fn rts(&self) -> RTS_R {
17        RTS_R::new((self.bits & 1) != 0)
18    }
19    #[doc = "Bit 1 - 1: Chip reset is detected from usb jtag channel. Software write 1 to clear it."]
20    #[inline(always)]
21    pub fn dtr(&self) -> DTR_R {
22        DTR_R::new(((self.bits >> 1) & 1) != 0)
23    }
24    #[doc = "Bit 2 - Set this bit to disable chip reset from usb serial channel to reset chip."]
25    #[inline(always)]
26    pub fn usb_uart_chip_rst_dis(&self) -> USB_UART_CHIP_RST_DIS_R {
27        USB_UART_CHIP_RST_DIS_R::new(((self.bits >> 2) & 1) != 0)
28    }
29}
30#[cfg(feature = "impl-register-debug")]
31impl core::fmt::Debug for R {
32    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
33        f.debug_struct("CHIP_RST")
34            .field("rts", &format_args!("{}", self.rts().bit()))
35            .field("dtr", &format_args!("{}", self.dtr().bit()))
36            .field(
37                "usb_uart_chip_rst_dis",
38                &format_args!("{}", self.usb_uart_chip_rst_dis().bit()),
39            )
40            .finish()
41    }
42}
43#[cfg(feature = "impl-register-debug")]
44impl core::fmt::Debug for crate::generic::Reg<CHIP_RST_SPEC> {
45    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
46        core::fmt::Debug::fmt(&self.read(), f)
47    }
48}
49impl W {
50    #[doc = "Bit 2 - Set this bit to disable chip reset from usb serial channel to reset chip."]
51    #[inline(always)]
52    #[must_use]
53    pub fn usb_uart_chip_rst_dis(&mut self) -> USB_UART_CHIP_RST_DIS_W<CHIP_RST_SPEC> {
54        USB_UART_CHIP_RST_DIS_W::new(self, 2)
55    }
56}
57#[doc = "CDC-ACM chip reset control.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`chip_rst::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 [`chip_rst::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
58pub struct CHIP_RST_SPEC;
59impl crate::RegisterSpec for CHIP_RST_SPEC {
60    type Ux = u32;
61}
62#[doc = "`read()` method returns [`chip_rst::R`](R) reader structure"]
63impl crate::Readable for CHIP_RST_SPEC {}
64#[doc = "`write(|w| ..)` method takes [`chip_rst::W`](W) writer structure"]
65impl crate::Writable for CHIP_RST_SPEC {
66    type Safety = crate::Unsafe;
67    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
68    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
69}
70#[doc = "`reset()` method sets CHIP_RST to value 0"]
71impl crate::Resettable for CHIP_RST_SPEC {
72    const RESET_VALUE: u32 = 0;
73}