atsam3s8b/pmc/
pmc_usb.rs

1#[doc = "Register `PMC_USB` reader"]
2pub type R = crate::R<PmcUsbSpec>;
3#[doc = "Register `PMC_USB` writer"]
4pub type W = crate::W<PmcUsbSpec>;
5#[doc = "Field `USBS` reader - USB Input Clock Selection"]
6pub type UsbsR = crate::BitReader;
7#[doc = "Field `USBS` writer - USB Input Clock Selection"]
8pub type UsbsW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `USBDIV` reader - Divider for USB Clock."]
10pub type UsbdivR = crate::FieldReader;
11#[doc = "Field `USBDIV` writer - Divider for USB Clock."]
12pub type UsbdivW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
13impl R {
14    #[doc = "Bit 0 - USB Input Clock Selection"]
15    #[inline(always)]
16    pub fn usbs(&self) -> UsbsR {
17        UsbsR::new((self.bits & 1) != 0)
18    }
19    #[doc = "Bits 8:11 - Divider for USB Clock."]
20    #[inline(always)]
21    pub fn usbdiv(&self) -> UsbdivR {
22        UsbdivR::new(((self.bits >> 8) & 0x0f) as u8)
23    }
24}
25impl W {
26    #[doc = "Bit 0 - USB Input Clock Selection"]
27    #[inline(always)]
28    #[must_use]
29    pub fn usbs(&mut self) -> UsbsW<PmcUsbSpec> {
30        UsbsW::new(self, 0)
31    }
32    #[doc = "Bits 8:11 - Divider for USB Clock."]
33    #[inline(always)]
34    #[must_use]
35    pub fn usbdiv(&mut self) -> UsbdivW<PmcUsbSpec> {
36        UsbdivW::new(self, 8)
37    }
38}
39#[doc = "USB Clock Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`pmc_usb::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 [`pmc_usb::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct PmcUsbSpec;
41impl crate::RegisterSpec for PmcUsbSpec {
42    type Ux = u32;
43}
44#[doc = "`read()` method returns [`pmc_usb::R`](R) reader structure"]
45impl crate::Readable for PmcUsbSpec {}
46#[doc = "`write(|w| ..)` method takes [`pmc_usb::W`](W) writer structure"]
47impl crate::Writable for PmcUsbSpec {
48    type Safety = crate::Unsafe;
49    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
50    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
51}
52#[doc = "`reset()` method sets PMC_USB to value 0"]
53impl crate::Resettable for PmcUsbSpec {
54    const RESET_VALUE: u32 = 0;
55}