esp32p4/usb_device/
get_line_code_w1.rs

1#[doc = "Register `GET_LINE_CODE_W1` reader"]
2pub type R = crate::R<GET_LINE_CODE_W1_SPEC>;
3#[doc = "Register `GET_LINE_CODE_W1` writer"]
4pub type W = crate::W<GET_LINE_CODE_W1_SPEC>;
5#[doc = "Field `GET_BDATA_BITS` reader - The value of bCharFormat set by software which is requested by GET_LINE_CODING command."]
6pub type GET_BDATA_BITS_R = crate::FieldReader;
7#[doc = "Field `GET_BDATA_BITS` writer - The value of bCharFormat set by software which is requested by GET_LINE_CODING command."]
8pub type GET_BDATA_BITS_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `GET_BPARITY_TYPE` reader - The value of bParityTpye set by software which is requested by GET_LINE_CODING command."]
10pub type GET_BPARITY_TYPE_R = crate::FieldReader;
11#[doc = "Field `GET_BPARITY_TYPE` writer - The value of bParityTpye set by software which is requested by GET_LINE_CODING command."]
12pub type GET_BPARITY_TYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
13#[doc = "Field `GET_BCHAR_FORMAT` reader - The value of bDataBits set by software which is requested by GET_LINE_CODING command."]
14pub type GET_BCHAR_FORMAT_R = crate::FieldReader;
15#[doc = "Field `GET_BCHAR_FORMAT` writer - The value of bDataBits set by software which is requested by GET_LINE_CODING command."]
16pub type GET_BCHAR_FORMAT_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
17impl R {
18    #[doc = "Bits 0:7 - The value of bCharFormat set by software which is requested by GET_LINE_CODING command."]
19    #[inline(always)]
20    pub fn get_bdata_bits(&self) -> GET_BDATA_BITS_R {
21        GET_BDATA_BITS_R::new((self.bits & 0xff) as u8)
22    }
23    #[doc = "Bits 8:15 - The value of bParityTpye set by software which is requested by GET_LINE_CODING command."]
24    #[inline(always)]
25    pub fn get_bparity_type(&self) -> GET_BPARITY_TYPE_R {
26        GET_BPARITY_TYPE_R::new(((self.bits >> 8) & 0xff) as u8)
27    }
28    #[doc = "Bits 16:23 - The value of bDataBits set by software which is requested by GET_LINE_CODING command."]
29    #[inline(always)]
30    pub fn get_bchar_format(&self) -> GET_BCHAR_FORMAT_R {
31        GET_BCHAR_FORMAT_R::new(((self.bits >> 16) & 0xff) as u8)
32    }
33}
34#[cfg(feature = "impl-register-debug")]
35impl core::fmt::Debug for R {
36    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
37        f.debug_struct("GET_LINE_CODE_W1")
38            .field(
39                "get_bdata_bits",
40                &format_args!("{}", self.get_bdata_bits().bits()),
41            )
42            .field(
43                "get_bparity_type",
44                &format_args!("{}", self.get_bparity_type().bits()),
45            )
46            .field(
47                "get_bchar_format",
48                &format_args!("{}", self.get_bchar_format().bits()),
49            )
50            .finish()
51    }
52}
53#[cfg(feature = "impl-register-debug")]
54impl core::fmt::Debug for crate::generic::Reg<GET_LINE_CODE_W1_SPEC> {
55    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
56        core::fmt::Debug::fmt(&self.read(), f)
57    }
58}
59impl W {
60    #[doc = "Bits 0:7 - The value of bCharFormat set by software which is requested by GET_LINE_CODING command."]
61    #[inline(always)]
62    #[must_use]
63    pub fn get_bdata_bits(&mut self) -> GET_BDATA_BITS_W<GET_LINE_CODE_W1_SPEC> {
64        GET_BDATA_BITS_W::new(self, 0)
65    }
66    #[doc = "Bits 8:15 - The value of bParityTpye set by software which is requested by GET_LINE_CODING command."]
67    #[inline(always)]
68    #[must_use]
69    pub fn get_bparity_type(&mut self) -> GET_BPARITY_TYPE_W<GET_LINE_CODE_W1_SPEC> {
70        GET_BPARITY_TYPE_W::new(self, 8)
71    }
72    #[doc = "Bits 16:23 - The value of bDataBits set by software which is requested by GET_LINE_CODING command."]
73    #[inline(always)]
74    #[must_use]
75    pub fn get_bchar_format(&mut self) -> GET_BCHAR_FORMAT_W<GET_LINE_CODE_W1_SPEC> {
76        GET_BCHAR_FORMAT_W::new(self, 16)
77    }
78}
79#[doc = "W1 of GET_LINE_CODING command.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`get_line_code_w1::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 [`get_line_code_w1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
80pub struct GET_LINE_CODE_W1_SPEC;
81impl crate::RegisterSpec for GET_LINE_CODE_W1_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [`get_line_code_w1::R`](R) reader structure"]
85impl crate::Readable for GET_LINE_CODE_W1_SPEC {}
86#[doc = "`write(|w| ..)` method takes [`get_line_code_w1::W`](W) writer structure"]
87impl crate::Writable for GET_LINE_CODE_W1_SPEC {
88    type Safety = crate::Unsafe;
89    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
90    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
91}
92#[doc = "`reset()` method sets GET_LINE_CODE_W1 to value 0"]
93impl crate::Resettable for GET_LINE_CODE_W1_SPEC {
94    const RESET_VALUE: u32 = 0;
95}