atsamd51g/sercom0/i2cm/
ctrlb.rs

1#[doc = "Register `CTRLB` reader"]
2pub type R = crate::R<CtrlbSpec>;
3#[doc = "Register `CTRLB` writer"]
4pub type W = crate::W<CtrlbSpec>;
5#[doc = "Field `SMEN` reader - Smart Mode Enable"]
6pub type SmenR = crate::BitReader;
7#[doc = "Field `SMEN` writer - Smart Mode Enable"]
8pub type SmenW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `QCEN` reader - Quick Command Enable"]
10pub type QcenR = crate::BitReader;
11#[doc = "Field `QCEN` writer - Quick Command Enable"]
12pub type QcenW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `CMD` reader - Command"]
14pub type CmdR = crate::FieldReader;
15#[doc = "Field `CMD` writer - Command"]
16pub type CmdW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `ACKACT` reader - Acknowledge Action"]
18pub type AckactR = crate::BitReader;
19#[doc = "Field `ACKACT` writer - Acknowledge Action"]
20pub type AckactW<'a, REG> = crate::BitWriter<'a, REG>;
21impl R {
22    #[doc = "Bit 8 - Smart Mode Enable"]
23    #[inline(always)]
24    pub fn smen(&self) -> SmenR {
25        SmenR::new(((self.bits >> 8) & 1) != 0)
26    }
27    #[doc = "Bit 9 - Quick Command Enable"]
28    #[inline(always)]
29    pub fn qcen(&self) -> QcenR {
30        QcenR::new(((self.bits >> 9) & 1) != 0)
31    }
32    #[doc = "Bits 16:17 - Command"]
33    #[inline(always)]
34    pub fn cmd(&self) -> CmdR {
35        CmdR::new(((self.bits >> 16) & 3) as u8)
36    }
37    #[doc = "Bit 18 - Acknowledge Action"]
38    #[inline(always)]
39    pub fn ackact(&self) -> AckactR {
40        AckactR::new(((self.bits >> 18) & 1) != 0)
41    }
42}
43impl W {
44    #[doc = "Bit 8 - Smart Mode Enable"]
45    #[inline(always)]
46    #[must_use]
47    pub fn smen(&mut self) -> SmenW<CtrlbSpec> {
48        SmenW::new(self, 8)
49    }
50    #[doc = "Bit 9 - Quick Command Enable"]
51    #[inline(always)]
52    #[must_use]
53    pub fn qcen(&mut self) -> QcenW<CtrlbSpec> {
54        QcenW::new(self, 9)
55    }
56    #[doc = "Bits 16:17 - Command"]
57    #[inline(always)]
58    #[must_use]
59    pub fn cmd(&mut self) -> CmdW<CtrlbSpec> {
60        CmdW::new(self, 16)
61    }
62    #[doc = "Bit 18 - Acknowledge Action"]
63    #[inline(always)]
64    #[must_use]
65    pub fn ackact(&mut self) -> AckactW<CtrlbSpec> {
66        AckactW::new(self, 18)
67    }
68}
69#[doc = "I2CM Control B\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrlb::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrlb::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
70pub struct CtrlbSpec;
71impl crate::RegisterSpec for CtrlbSpec {
72    type Ux = u32;
73}
74#[doc = "`read()` method returns [`ctrlb::R`](R) reader structure"]
75impl crate::Readable for CtrlbSpec {}
76#[doc = "`write(|w| ..)` method takes [`ctrlb::W`](W) writer structure"]
77impl crate::Writable for CtrlbSpec {
78    type Safety = crate::Unsafe;
79    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
80    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
81}
82#[doc = "`reset()` method sets CTRLB to value 0"]
83impl crate::Resettable for CtrlbSpec {
84    const RESET_VALUE: u32 = 0;
85}