1#[doc = "Register `STAT` reader"]
2pub type R = crate::R<StatSpec>;
3#[doc = "Odd Bank\n\nValue on reset: 0"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum Odd {
7 #[doc = "0: Not in the odd bank"]
8 NotInOddBank = 0,
9 #[doc = "1: In the odd bank"]
10 OddBank = 1,
11}
12impl From<Odd> for bool {
13 #[inline(always)]
14 fn from(variant: Odd) -> Self {
15 variant as u8 != 0
16 }
17}
18#[doc = "Field `ODD` reader - Odd Bank"]
19pub type OddR = crate::BitReader<Odd>;
20impl OddR {
21 #[doc = "Get enumerated values variant"]
22 #[inline(always)]
23 pub const fn variant(&self) -> Odd {
24 match self.bits {
25 false => Odd::NotInOddBank,
26 true => Odd::OddBank,
27 }
28 }
29 #[doc = "Not in the odd bank"]
30 #[inline(always)]
31 pub fn is_not_in_odd_bank(&self) -> bool {
32 *self == Odd::NotInOddBank
33 }
34 #[doc = "In the odd bank"]
35 #[inline(always)]
36 pub fn is_odd_bank(&self) -> bool {
37 *self == Odd::OddBank
38 }
39}
40#[doc = "Transmit Indicator\n\nValue on reset: 0"]
41#[cfg_attr(feature = "defmt", derive(defmt::Format))]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum Tx {
44 #[doc = "0: Receive"]
45 RxTransaction = 0,
46 #[doc = "1: Transmit"]
47 TxTransaction = 1,
48}
49impl From<Tx> for bool {
50 #[inline(always)]
51 fn from(variant: Tx) -> Self {
52 variant as u8 != 0
53 }
54}
55#[doc = "Field `TX` reader - Transmit Indicator"]
56pub type TxR = crate::BitReader<Tx>;
57impl TxR {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub const fn variant(&self) -> Tx {
61 match self.bits {
62 false => Tx::RxTransaction,
63 true => Tx::TxTransaction,
64 }
65 }
66 #[doc = "Receive"]
67 #[inline(always)]
68 pub fn is_rx_transaction(&self) -> bool {
69 *self == Tx::RxTransaction
70 }
71 #[doc = "Transmit"]
72 #[inline(always)]
73 pub fn is_tx_transaction(&self) -> bool {
74 *self == Tx::TxTransaction
75 }
76}
77#[doc = "Field `ENDP` reader - Endpoint address"]
78pub type EndpR = crate::FieldReader;
79impl R {
80 #[doc = "Bit 2 - Odd Bank"]
81 #[inline(always)]
82 pub fn odd(&self) -> OddR {
83 OddR::new(((self.bits >> 2) & 1) != 0)
84 }
85 #[doc = "Bit 3 - Transmit Indicator"]
86 #[inline(always)]
87 pub fn tx(&self) -> TxR {
88 TxR::new(((self.bits >> 3) & 1) != 0)
89 }
90 #[doc = "Bits 4:7 - Endpoint address"]
91 #[inline(always)]
92 pub fn endp(&self) -> EndpR {
93 EndpR::new((self.bits >> 4) & 0x0f)
94 }
95}
96#[cfg(feature = "debug")]
97impl core::fmt::Debug for R {
98 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
99 f.debug_struct("STAT")
100 .field("odd", &self.odd())
101 .field("tx", &self.tx())
102 .field("endp", &self.endp())
103 .finish()
104 }
105}
106#[doc = "Status\n\nYou can [`read`](crate::Reg::read) this register and get [`stat::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
107pub struct StatSpec;
108impl crate::RegisterSpec for StatSpec {
109 type Ux = u8;
110}
111#[doc = "`read()` method returns [`stat::R`](R) reader structure"]
112impl crate::Readable for StatSpec {}
113#[doc = "`reset()` method sets STAT to value 0"]
114impl crate::Resettable for StatSpec {}