atsaml21e18a/sercom0/i2cm/
ctrlb.rs

1#[doc = "Register `CTRLB` reader"]
2pub struct R(crate::R<CTRLB_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CTRLB_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CTRLB_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CTRLB_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CTRLB` writer"]
17pub struct W(crate::W<CTRLB_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CTRLB_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<CTRLB_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CTRLB_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SMEN` reader - Smart Mode Enable"]
38pub type SMEN_R = crate::BitReader<bool>;
39#[doc = "Field `SMEN` writer - Smart Mode Enable"]
40pub type SMEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRLB_SPEC, bool, O>;
41#[doc = "Field `QCEN` reader - Quick Command Enable"]
42pub type QCEN_R = crate::BitReader<bool>;
43#[doc = "Field `QCEN` writer - Quick Command Enable"]
44pub type QCEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRLB_SPEC, bool, O>;
45#[doc = "Field `CMD` writer - Command"]
46pub type CMD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRLB_SPEC, u8, u8, 2, O>;
47#[doc = "Field `ACKACT` reader - Acknowledge Action"]
48pub type ACKACT_R = crate::BitReader<bool>;
49#[doc = "Field `ACKACT` writer - Acknowledge Action"]
50pub type ACKACT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRLB_SPEC, bool, O>;
51impl R {
52    #[doc = "Bit 8 - Smart Mode Enable"]
53    #[inline(always)]
54    pub fn smen(&self) -> SMEN_R {
55        SMEN_R::new(((self.bits >> 8) & 1) != 0)
56    }
57    #[doc = "Bit 9 - Quick Command Enable"]
58    #[inline(always)]
59    pub fn qcen(&self) -> QCEN_R {
60        QCEN_R::new(((self.bits >> 9) & 1) != 0)
61    }
62    #[doc = "Bit 18 - Acknowledge Action"]
63    #[inline(always)]
64    pub fn ackact(&self) -> ACKACT_R {
65        ACKACT_R::new(((self.bits >> 18) & 1) != 0)
66    }
67}
68impl W {
69    #[doc = "Bit 8 - Smart Mode Enable"]
70    #[inline(always)]
71    #[must_use]
72    pub fn smen(&mut self) -> SMEN_W<8> {
73        SMEN_W::new(self)
74    }
75    #[doc = "Bit 9 - Quick Command Enable"]
76    #[inline(always)]
77    #[must_use]
78    pub fn qcen(&mut self) -> QCEN_W<9> {
79        QCEN_W::new(self)
80    }
81    #[doc = "Bits 16:17 - Command"]
82    #[inline(always)]
83    #[must_use]
84    pub fn cmd(&mut self) -> CMD_W<16> {
85        CMD_W::new(self)
86    }
87    #[doc = "Bit 18 - Acknowledge Action"]
88    #[inline(always)]
89    #[must_use]
90    pub fn ackact(&mut self) -> ACKACT_W<18> {
91        ACKACT_W::new(self)
92    }
93    #[doc = "Writes raw bits to the register."]
94    #[inline(always)]
95    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
96        self.0.bits(bits);
97        self
98    }
99}
100#[doc = "I2CM Control B\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 [ctrlb](index.html) module"]
101pub struct CTRLB_SPEC;
102impl crate::RegisterSpec for CTRLB_SPEC {
103    type Ux = u32;
104}
105#[doc = "`read()` method returns [ctrlb::R](R) reader structure"]
106impl crate::Readable for CTRLB_SPEC {
107    type Reader = R;
108}
109#[doc = "`write(|w| ..)` method takes [ctrlb::W](W) writer structure"]
110impl crate::Writable for CTRLB_SPEC {
111    type Writer = W;
112    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
113    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
114}
115#[doc = "`reset()` method sets CTRLB to value 0"]
116impl crate::Resettable for CTRLB_SPEC {
117    const RESET_VALUE: Self::Ux = 0;
118}