corstone300_pac/i2c0/
control.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 `CONTROL` reader"]
6pub struct R(crate::R<CONTROL_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<CONTROL_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<CONTROL_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<CONTROL_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Field `SCL` reader - Serial clock line"]
21pub type SCL_R = crate::BitReader<bool>;
22#[doc = "Field `SDA` reader - Serial data line"]
23pub type SDA_R = crate::BitReader<bool>;
24impl R {
25    #[doc = "Bit 0 - Serial clock line"]
26    #[inline(always)]
27    pub fn scl(&self) -> SCL_R {
28        SCL_R::new((self.bits & 1) != 0)
29    }
30    #[doc = "Bit 1 - Serial data line"]
31    #[inline(always)]
32    pub fn sda(&self) -> SDA_R {
33        SDA_R::new(((self.bits >> 1) & 1) != 0)
34    }
35}
36#[doc = "Control Status\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [control](index.html) module"]
37pub struct CONTROL_SPEC;
38impl crate::RegisterSpec for CONTROL_SPEC {
39    type Ux = u32;
40}
41#[doc = "`read()` method returns [control::R](R) reader structure"]
42impl crate::Readable for CONTROL_SPEC {
43    type Reader = R;
44}
45#[doc = "`reset()` method sets CONTROL to value 0"]
46impl crate::Resettable for CONTROL_SPEC {
47    #[inline(always)]
48    fn reset_value() -> Self::Ux {
49        0
50    }
51}