cc2538/gpio_a/
usb_ctrl.rs

1#[doc = "Reader of register USB_CTRL"]
2pub type R = crate::R<u32, super::USB_CTRL>;
3#[doc = "Writer for register USB_CTRL"]
4pub type W = crate::W<u32, super::USB_CTRL>;
5#[doc = "Register USB_CTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::USB_CTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `Reserved31`"]
14pub type RESERVED31_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `Reserved31`"]
16pub struct RESERVED31_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RESERVED31_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x7fff_ffff << 1)) | (((value as u32) & 0x7fff_ffff) << 1);
24        self.w
25    }
26}
27#[doc = "Reader of field `USB_EDGE_CTL`"]
28pub type USB_EDGE_CTL_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `USB_EDGE_CTL`"]
30pub struct USB_EDGE_CTL_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> USB_EDGE_CTL_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
48        self.w
49    }
50}
51impl R {
52    #[doc = "Bits 1:31"]
53    #[inline(always)]
54    pub fn reserved31(&self) -> RESERVED31_R {
55        RESERVED31_R::new(((self.bits >> 1) & 0x7fff_ffff) as u32)
56    }
57    #[doc = "Bit 0 - 0:0\\] Used to set the edge which triggers the USB power up interrupt 0: Rising 1: Falling"]
58    #[inline(always)]
59    pub fn usb_edge_ctl(&self) -> USB_EDGE_CTL_R {
60        USB_EDGE_CTL_R::new((self.bits & 0x01) != 0)
61    }
62}
63impl W {
64    #[doc = "Bits 1:31"]
65    #[inline(always)]
66    pub fn reserved31(&mut self) -> RESERVED31_W {
67        RESERVED31_W { w: self }
68    }
69    #[doc = "Bit 0 - 0:0\\] Used to set the edge which triggers the USB power up interrupt 0: Rising 1: Falling"]
70    #[inline(always)]
71    pub fn usb_edge_ctl(&mut self) -> USB_EDGE_CTL_W {
72        USB_EDGE_CTL_W { w: self }
73    }
74}