corstone300_pac/i2c0/
controlc.rs

1// Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
2//
3// SPDX-License-Identifier: MIT
4
5#[doc = "Register `CONTROLC` reader"]
6pub struct R(crate::R<CONTROLC_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<CONTROLC_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<CONTROLC_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<CONTROLC_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `CONTROLC` writer"]
21pub struct W(crate::W<CONTROLC_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<CONTROLC_SPEC>;
24    #[inline(always)]
25    fn deref(&self) -> &Self::Target {
26        &self.0
27    }
28}
29impl core::ops::DerefMut for W {
30    #[inline(always)]
31    fn deref_mut(&mut self) -> &mut Self::Target {
32        &mut self.0
33    }
34}
35impl From<crate::W<CONTROLC_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<CONTROLC_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `SCL` reader - Serial clock line"]
42pub type SCL_R = crate::BitReader<bool>;
43#[doc = "Field `SCL` writer - Serial clock line"]
44pub type SCL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONTROLC_SPEC, bool, O>;
45#[doc = "Field `SDA` reader - Serial data line"]
46pub type SDA_R = crate::BitReader<bool>;
47#[doc = "Field `SDA` writer - Serial data line"]
48pub type SDA_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONTROLC_SPEC, bool, O>;
49impl R {
50    #[doc = "Bit 0 - Serial clock line"]
51    #[inline(always)]
52    pub fn scl(&self) -> SCL_R {
53        SCL_R::new((self.bits & 1) != 0)
54    }
55    #[doc = "Bit 1 - Serial data line"]
56    #[inline(always)]
57    pub fn sda(&self) -> SDA_R {
58        SDA_R::new(((self.bits >> 1) & 1) != 0)
59    }
60}
61impl W {
62    #[doc = "Bit 0 - Serial clock line"]
63    #[inline(always)]
64    pub fn scl(&mut self) -> SCL_W<0> {
65        SCL_W::new(self)
66    }
67    #[doc = "Bit 1 - Serial data line"]
68    #[inline(always)]
69    pub fn sda(&mut self) -> SDA_W<1> {
70        SDA_W::new(self)
71    }
72    #[doc = "Writes raw bits to the register."]
73    #[inline(always)]
74    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
75        self.0.bits(bits);
76        self
77    }
78}
79#[doc = "Control Clear\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 [controlc](index.html) module"]
80pub struct CONTROLC_SPEC;
81impl crate::RegisterSpec for CONTROLC_SPEC {
82    type Ux = u32;
83}
84#[doc = "`read()` method returns [controlc::R](R) reader structure"]
85impl crate::Readable for CONTROLC_SPEC {
86    type Reader = R;
87}
88#[doc = "`write(|w| ..)` method takes [controlc::W](W) writer structure"]
89impl crate::Writable for CONTROLC_SPEC {
90    type Writer = W;
91}
92#[doc = "`reset()` method sets CONTROLC to value 0"]
93impl crate::Resettable for CONTROLC_SPEC {
94    #[inline(always)]
95    fn reset_value() -> Self::Ux {
96        0
97    }
98}