nrf52840_pac/usbd/
isosplit.rs
1#[doc = "Register `ISOSPLIT` reader"]
2pub struct R(crate::R<ISOSPLIT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ISOSPLIT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ISOSPLIT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ISOSPLIT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ISOSPLIT` writer"]
17pub struct W(crate::W<ISOSPLIT_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ISOSPLIT_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<ISOSPLIT_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ISOSPLIT_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SPLIT` reader - Controls the split of ISO buffers"]
38pub type SPLIT_R = crate::FieldReader<u16, SPLIT_A>;
39#[doc = "Controls the split of ISO buffers\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u16)]
42pub enum SPLIT_A {
43 #[doc = "0: Full buffer dedicated to either iso IN or OUT"]
44 ONE_DIR = 0,
45 #[doc = "128: Lower half for IN, upper half for OUT"]
46 HALF_IN = 128,
47}
48impl From<SPLIT_A> for u16 {
49 #[inline(always)]
50 fn from(variant: SPLIT_A) -> Self {
51 variant as _
52 }
53}
54impl SPLIT_R {
55 #[doc = "Get enumerated values variant"]
56 #[inline(always)]
57 pub fn variant(&self) -> Option<SPLIT_A> {
58 match self.bits {
59 0 => Some(SPLIT_A::ONE_DIR),
60 128 => Some(SPLIT_A::HALF_IN),
61 _ => None,
62 }
63 }
64 #[doc = "Checks if the value of the field is `ONE_DIR`"]
65 #[inline(always)]
66 pub fn is_one_dir(&self) -> bool {
67 *self == SPLIT_A::ONE_DIR
68 }
69 #[doc = "Checks if the value of the field is `HALF_IN`"]
70 #[inline(always)]
71 pub fn is_half_in(&self) -> bool {
72 *self == SPLIT_A::HALF_IN
73 }
74}
75#[doc = "Field `SPLIT` writer - Controls the split of ISO buffers"]
76pub type SPLIT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, ISOSPLIT_SPEC, u16, SPLIT_A, 16, O>;
77impl<'a, const O: u8> SPLIT_W<'a, O> {
78 #[doc = "Full buffer dedicated to either iso IN or OUT"]
79 #[inline(always)]
80 pub fn one_dir(self) -> &'a mut W {
81 self.variant(SPLIT_A::ONE_DIR)
82 }
83 #[doc = "Lower half for IN, upper half for OUT"]
84 #[inline(always)]
85 pub fn half_in(self) -> &'a mut W {
86 self.variant(SPLIT_A::HALF_IN)
87 }
88}
89impl R {
90 #[doc = "Bits 0:15 - Controls the split of ISO buffers"]
91 #[inline(always)]
92 pub fn split(&self) -> SPLIT_R {
93 SPLIT_R::new((self.bits & 0xffff) as u16)
94 }
95}
96impl W {
97 #[doc = "Bits 0:15 - Controls the split of ISO buffers"]
98 #[inline(always)]
99 pub fn split(&mut self) -> SPLIT_W<0> {
100 SPLIT_W::new(self)
101 }
102 #[doc = "Writes raw bits to the register."]
103 #[inline(always)]
104 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
105 self.0.bits(bits);
106 self
107 }
108}
109#[doc = "Controls the split of ISO buffers\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [isosplit](index.html) module"]
110pub struct ISOSPLIT_SPEC;
111impl crate::RegisterSpec for ISOSPLIT_SPEC {
112 type Ux = u32;
113}
114#[doc = "`read()` method returns [isosplit::R](R) reader structure"]
115impl crate::Readable for ISOSPLIT_SPEC {
116 type Reader = R;
117}
118#[doc = "`write(|w| ..)` method takes [isosplit::W](W) writer structure"]
119impl crate::Writable for ISOSPLIT_SPEC {
120 type Writer = W;
121}
122#[doc = "`reset()` method sets ISOSPLIT to value 0"]
123impl crate::Resettable for ISOSPLIT_SPEC {
124 #[inline(always)]
125 fn reset_value() -> Self::Ux {
126 0
127 }
128}