atsamd11c/sercom0/i2cs/
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 `GCMD` reader - PMBus Group Command"]
10pub type GcmdR = crate::BitReader;
11#[doc = "Field `GCMD` writer - PMBus Group Command"]
12pub type GcmdW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `AACKEN` reader - Automatic Address Acknowledge"]
14pub type AackenR = crate::BitReader;
15#[doc = "Field `AACKEN` writer - Automatic Address Acknowledge"]
16pub type AackenW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `AMODE` reader - Address Mode"]
18pub type AmodeR = crate::FieldReader;
19#[doc = "Field `AMODE` writer - Address Mode"]
20pub type AmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
21#[doc = "Field `CMD` writer - Command"]
22pub type CmdW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
23#[doc = "Field `ACKACT` reader - Acknowledge Action"]
24pub type AckactR = crate::BitReader;
25#[doc = "Field `ACKACT` writer - Acknowledge Action"]
26pub type AckactW<'a, REG> = crate::BitWriter<'a, REG>;
27impl R {
28    #[doc = "Bit 8 - Smart Mode Enable"]
29    #[inline(always)]
30    pub fn smen(&self) -> SmenR {
31        SmenR::new(((self.bits >> 8) & 1) != 0)
32    }
33    #[doc = "Bit 9 - PMBus Group Command"]
34    #[inline(always)]
35    pub fn gcmd(&self) -> GcmdR {
36        GcmdR::new(((self.bits >> 9) & 1) != 0)
37    }
38    #[doc = "Bit 10 - Automatic Address Acknowledge"]
39    #[inline(always)]
40    pub fn aacken(&self) -> AackenR {
41        AackenR::new(((self.bits >> 10) & 1) != 0)
42    }
43    #[doc = "Bits 14:15 - Address Mode"]
44    #[inline(always)]
45    pub fn amode(&self) -> AmodeR {
46        AmodeR::new(((self.bits >> 14) & 3) as u8)
47    }
48    #[doc = "Bit 18 - Acknowledge Action"]
49    #[inline(always)]
50    pub fn ackact(&self) -> AckactR {
51        AckactR::new(((self.bits >> 18) & 1) != 0)
52    }
53}
54impl W {
55    #[doc = "Bit 8 - Smart Mode Enable"]
56    #[inline(always)]
57    #[must_use]
58    pub fn smen(&mut self) -> SmenW<CtrlbSpec> {
59        SmenW::new(self, 8)
60    }
61    #[doc = "Bit 9 - PMBus Group Command"]
62    #[inline(always)]
63    #[must_use]
64    pub fn gcmd(&mut self) -> GcmdW<CtrlbSpec> {
65        GcmdW::new(self, 9)
66    }
67    #[doc = "Bit 10 - Automatic Address Acknowledge"]
68    #[inline(always)]
69    #[must_use]
70    pub fn aacken(&mut self) -> AackenW<CtrlbSpec> {
71        AackenW::new(self, 10)
72    }
73    #[doc = "Bits 14:15 - Address Mode"]
74    #[inline(always)]
75    #[must_use]
76    pub fn amode(&mut self) -> AmodeW<CtrlbSpec> {
77        AmodeW::new(self, 14)
78    }
79    #[doc = "Bits 16:17 - Command"]
80    #[inline(always)]
81    #[must_use]
82    pub fn cmd(&mut self) -> CmdW<CtrlbSpec> {
83        CmdW::new(self, 16)
84    }
85    #[doc = "Bit 18 - Acknowledge Action"]
86    #[inline(always)]
87    #[must_use]
88    pub fn ackact(&mut self) -> AckactW<CtrlbSpec> {
89        AckactW::new(self, 18)
90    }
91}
92#[doc = "I2CS 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)."]
93pub struct CtrlbSpec;
94impl crate::RegisterSpec for CtrlbSpec {
95    type Ux = u32;
96}
97#[doc = "`read()` method returns [`ctrlb::R`](R) reader structure"]
98impl crate::Readable for CtrlbSpec {}
99#[doc = "`write(|w| ..)` method takes [`ctrlb::W`](W) writer structure"]
100impl crate::Writable for CtrlbSpec {
101    type Safety = crate::Unsafe;
102    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
103    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
104}
105#[doc = "`reset()` method sets CTRLB to value 0"]
106impl crate::Resettable for CtrlbSpec {
107    const RESET_VALUE: u32 = 0;
108}