cc2538_pac/usb/
index.rs

1#[doc = "Register `INDEX` reader"]
2pub type R = crate::R<IndexSpec>;
3#[doc = "Register `INDEX` writer"]
4pub type W = crate::W<IndexSpec>;
5#[doc = "Field `USBINDEX` reader - Index of the currently selected endpoint The index is set to 0 to enable access to endpoint 0 control and status registers The index is set to 1, 2, 3, 4 or 5 to enable access to IN/OUT endpoint 1, 2, 3, 4 or 5 control and status registers, respectively"]
6pub type UsbindexR = crate::FieldReader;
7#[doc = "Field `USBINDEX` writer - Index of the currently selected endpoint The index is set to 0 to enable access to endpoint 0 control and status registers The index is set to 1, 2, 3, 4 or 5 to enable access to IN/OUT endpoint 1, 2, 3, 4 or 5 control and status registers, respectively"]
8pub type UsbindexW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9impl R {
10    #[doc = "Bits 0:3 - Index of the currently selected endpoint The index is set to 0 to enable access to endpoint 0 control and status registers The index is set to 1, 2, 3, 4 or 5 to enable access to IN/OUT endpoint 1, 2, 3, 4 or 5 control and status registers, respectively"]
11    #[inline(always)]
12    pub fn usbindex(&self) -> UsbindexR {
13        UsbindexR::new((self.bits & 0x0f) as u8)
14    }
15}
16impl W {
17    #[doc = "Bits 0:3 - Index of the currently selected endpoint The index is set to 0 to enable access to endpoint 0 control and status registers The index is set to 1, 2, 3, 4 or 5 to enable access to IN/OUT endpoint 1, 2, 3, 4 or 5 control and status registers, respectively"]
18    #[inline(always)]
19    pub fn usbindex(&mut self) -> UsbindexW<IndexSpec> {
20        UsbindexW::new(self, 0)
21    }
22}
23#[doc = "Index register for selecting the endpoint status and control registers\n\nYou can [`read`](crate::Reg::read) this register and get [`index::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`index::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
24pub struct IndexSpec;
25impl crate::RegisterSpec for IndexSpec {
26    type Ux = u32;
27}
28#[doc = "`read()` method returns [`index::R`](R) reader structure"]
29impl crate::Readable for IndexSpec {}
30#[doc = "`write(|w| ..)` method takes [`index::W`](W) writer structure"]
31impl crate::Writable for IndexSpec {
32    type Safety = crate::Unsafe;
33    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
34    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
35}
36#[doc = "`reset()` method sets INDEX to value 0"]
37impl crate::Resettable for IndexSpec {
38    const RESET_VALUE: u32 = 0;
39}