Skip to main content

mcxa_pac/usb0/
addinfo.rs

1#[doc = "Register `ADDINFO` reader"]
2pub type R = crate::R<AddinfoSpec>;
3#[doc = "Host Mode Enable\n\nValue on reset: 1"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum Iehost {
7    #[doc = "0: Disabled"]
8    Disabled = 0,
9    #[doc = "1: Enabled"]
10    Enabled = 1,
11}
12impl From<Iehost> for bool {
13    #[inline(always)]
14    fn from(variant: Iehost) -> Self {
15        variant as u8 != 0
16    }
17}
18#[doc = "Field `IEHOST` reader - Host Mode Enable"]
19pub type IehostR = crate::BitReader<Iehost>;
20impl IehostR {
21    #[doc = "Get enumerated values variant"]
22    #[inline(always)]
23    pub const fn variant(&self) -> Iehost {
24        match self.bits {
25            false => Iehost::Disabled,
26            true => Iehost::Enabled,
27        }
28    }
29    #[doc = "Disabled"]
30    #[inline(always)]
31    pub fn is_disabled(&self) -> bool {
32        *self == Iehost::Disabled
33    }
34    #[doc = "Enabled"]
35    #[inline(always)]
36    pub fn is_enabled(&self) -> bool {
37        *self == Iehost::Enabled
38    }
39}
40impl R {
41    #[doc = "Bit 0 - Host Mode Enable"]
42    #[inline(always)]
43    pub fn iehost(&self) -> IehostR {
44        IehostR::new((self.bits & 1) != 0)
45    }
46}
47#[cfg(feature = "debug")]
48impl core::fmt::Debug for R {
49    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
50        f.debug_struct("ADDINFO").field("iehost", &self.iehost()).finish()
51    }
52}
53#[doc = "Peripheral Additional Information\n\nYou can [`read`](crate::Reg::read) this register and get [`addinfo::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
54pub struct AddinfoSpec;
55impl crate::RegisterSpec for AddinfoSpec {
56    type Ux = u8;
57}
58#[doc = "`read()` method returns [`addinfo::R`](R) reader structure"]
59impl crate::Readable for AddinfoSpec {}
60#[doc = "`reset()` method sets ADDINFO to value 0x01"]
61impl crate::Resettable for AddinfoSpec {
62    const RESET_VALUE: u8 = 0x01;
63}