nrf52840_pac/usbd/size/
isoout.rs1#[doc = "Register `ISOOUT` reader"]
2pub struct R(crate::R<ISOOUT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ISOOUT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ISOOUT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ISOOUT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `SIZE` reader - Number of bytes received last on this ISO OUT data endpoint"]
17pub type SIZE_R = crate::FieldReader<u16, u16>;
18#[doc = "Field `ZERO` reader - Zero-length data packet received"]
19pub type ZERO_R = crate::BitReader<ZERO_A>;
20#[doc = "Zero-length data packet received\n\nValue on reset: 1"]
21#[derive(Clone, Copy, Debug, PartialEq)]
22pub enum ZERO_A {
23 #[doc = "0: No zero-length data received, use value in SIZE"]
24 NORMAL = 0,
25 #[doc = "1: Zero-length data received, ignore value in SIZE"]
26 ZERO_DATA = 1,
27}
28impl From<ZERO_A> for bool {
29 #[inline(always)]
30 fn from(variant: ZERO_A) -> Self {
31 variant as u8 != 0
32 }
33}
34impl ZERO_R {
35 #[doc = "Get enumerated values variant"]
36 #[inline(always)]
37 pub fn variant(&self) -> ZERO_A {
38 match self.bits {
39 false => ZERO_A::NORMAL,
40 true => ZERO_A::ZERO_DATA,
41 }
42 }
43 #[doc = "Checks if the value of the field is `NORMAL`"]
44 #[inline(always)]
45 pub fn is_normal(&self) -> bool {
46 *self == ZERO_A::NORMAL
47 }
48 #[doc = "Checks if the value of the field is `ZERO_DATA`"]
49 #[inline(always)]
50 pub fn is_zero_data(&self) -> bool {
51 *self == ZERO_A::ZERO_DATA
52 }
53}
54impl R {
55 #[doc = "Bits 0:9 - Number of bytes received last on this ISO OUT data endpoint"]
56 #[inline(always)]
57 pub fn size(&self) -> SIZE_R {
58 SIZE_R::new((self.bits & 0x03ff) as u16)
59 }
60 #[doc = "Bit 16 - Zero-length data packet received"]
61 #[inline(always)]
62 pub fn zero(&self) -> ZERO_R {
63 ZERO_R::new(((self.bits >> 16) & 1) != 0)
64 }
65}
66#[doc = "Number of bytes received last on this ISO OUT data endpoint\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [isoout](index.html) module"]
67pub struct ISOOUT_SPEC;
68impl crate::RegisterSpec for ISOOUT_SPEC {
69 type Ux = u32;
70}
71#[doc = "`read()` method returns [isoout::R](R) reader structure"]
72impl crate::Readable for ISOOUT_SPEC {
73 type Reader = R;
74}
75#[doc = "`reset()` method sets ISOOUT to value 0x0001_0000"]
76impl crate::Resettable for ISOOUT_SPEC {
77 #[inline(always)]
78 fn reset_value() -> Self::Ux {
79 0x0001_0000
80 }
81}