1#[doc = "Register `ADDR_ENDP` reader"]
2pub type R = crate::R<ADDR_ENDP_SPEC>;
3#[doc = "Register `ADDR_ENDP` writer"]
4pub type W = crate::W<ADDR_ENDP_SPEC>;
5#[doc = "Field `ADDRESS` reader - In device mode, the address that the device should respond to. Set in response to a SET_ADDR setup packet from the host. In host mode set to the address of the device to communicate with."]
6pub type ADDRESS_R = crate::FieldReader;
7#[doc = "Field `ADDRESS` writer - In device mode, the address that the device should respond to. Set in response to a SET_ADDR setup packet from the host. In host mode set to the address of the device to communicate with."]
8pub type ADDRESS_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
9#[doc = "Field `ENDPOINT` reader - Device endpoint to send data to. Only valid for HOST mode."]
10pub type ENDPOINT_R = crate::FieldReader;
11#[doc = "Field `ENDPOINT` writer - Device endpoint to send data to. Only valid for HOST mode."]
12pub type ENDPOINT_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
13impl R {
14#[doc = "Bits 0:6 - In device mode, the address that the device should respond to. Set in response to a SET_ADDR setup packet from the host. In host mode set to the address of the device to communicate with."]
15 #[inline(always)]
16pub fn address(&self) -> ADDRESS_R {
17 ADDRESS_R::new((self.bits & 0x7f) as u8)
18 }
19#[doc = "Bits 16:19 - Device endpoint to send data to. Only valid for HOST mode."]
20 #[inline(always)]
21pub fn endpoint(&self) -> ENDPOINT_R {
22 ENDPOINT_R::new(((self.bits >> 16) & 0x0f) as u8)
23 }
24}
25impl W {
26#[doc = "Bits 0:6 - In device mode, the address that the device should respond to. Set in response to a SET_ADDR setup packet from the host. In host mode set to the address of the device to communicate with."]
27 #[inline(always)]
28 #[must_use]
29pub fn address(&mut self) -> ADDRESS_W<ADDR_ENDP_SPEC> {
30 ADDRESS_W::new(self, 0)
31 }
32#[doc = "Bits 16:19 - Device endpoint to send data to. Only valid for HOST mode."]
33 #[inline(always)]
34 #[must_use]
35pub fn endpoint(&mut self) -> ENDPOINT_W<ADDR_ENDP_SPEC> {
36 ENDPOINT_W::new(self, 16)
37 }
38#[doc = r" Writes raw bits to the register."]
39 #[doc = r""]
40 #[doc = r" # Safety"]
41 #[doc = r""]
42 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
43 #[inline(always)]
44pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
45self.bits = bits;
46self
47}
48}
49#[doc = "Device address and endpoint control
5051You can [`read`](crate::generic::Reg::read) this register and get [`addr_endp::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 [`addr_endp::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
52pub struct ADDR_ENDP_SPEC;
53impl crate::RegisterSpec for ADDR_ENDP_SPEC {
54type Ux = u32;
55}
56#[doc = "`read()` method returns [`addr_endp::R`](R) reader structure"]
57impl crate::Readable for ADDR_ENDP_SPEC {}
58#[doc = "`write(|w| ..)` method takes [`addr_endp::W`](W) writer structure"]
59impl crate::Writable for ADDR_ENDP_SPEC {
60const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
61const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
62}
63#[doc = "`reset()` method sets ADDR_ENDP to value 0"]
64impl crate::Resettable for ADDR_ENDP_SPEC {
65const RESET_VALUE: u32 = 0;
66}