nrf52832_pac/spi0/psel/
sck.rs

1#[doc = "Register `SCK` reader"]
2pub struct R(crate::R<SCK_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SCK_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SCK_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SCK_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SCK` writer"]
17pub struct W(crate::W<SCK_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SCK_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<SCK_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SCK_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PSELSCK` reader - Pin number configuration for SPI SCK signal"]
38pub type PSELSCK_R = crate::FieldReader<u32, PSELSCK_A>;
39#[doc = "Pin number configuration for SPI SCK signal\n\nValue on reset: 4294967295"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u32)]
42pub enum PSELSCK_A {
43    #[doc = "4294967295: Disconnect"]
44    DISCONNECTED = 4294967295,
45}
46impl From<PSELSCK_A> for u32 {
47    #[inline(always)]
48    fn from(variant: PSELSCK_A) -> Self {
49        variant as _
50    }
51}
52impl PSELSCK_R {
53    #[doc = "Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> Option<PSELSCK_A> {
56        match self.bits {
57            4294967295 => Some(PSELSCK_A::DISCONNECTED),
58            _ => None,
59        }
60    }
61    #[doc = "Checks if the value of the field is `DISCONNECTED`"]
62    #[inline(always)]
63    pub fn is_disconnected(&self) -> bool {
64        *self == PSELSCK_A::DISCONNECTED
65    }
66}
67#[doc = "Field `PSELSCK` writer - Pin number configuration for SPI SCK signal"]
68pub type PSELSCK_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SCK_SPEC, u32, PSELSCK_A, 32, O>;
69impl<'a, const O: u8> PSELSCK_W<'a, O> {
70    #[doc = "Disconnect"]
71    #[inline(always)]
72    pub fn disconnected(self) -> &'a mut W {
73        self.variant(PSELSCK_A::DISCONNECTED)
74    }
75}
76impl R {
77    #[doc = "Bits 0:31 - Pin number configuration for SPI SCK signal"]
78    #[inline(always)]
79    pub fn pselsck(&self) -> PSELSCK_R {
80        PSELSCK_R::new(self.bits)
81    }
82}
83impl W {
84    #[doc = "Bits 0:31 - Pin number configuration for SPI SCK signal"]
85    #[inline(always)]
86    pub fn pselsck(&mut self) -> PSELSCK_W<0> {
87        PSELSCK_W::new(self)
88    }
89    #[doc = "Writes raw bits to the register."]
90    #[inline(always)]
91    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
92        self.0.bits(bits);
93        self
94    }
95}
96#[doc = "Pin select for SCK\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 [sck](index.html) module"]
97pub struct SCK_SPEC;
98impl crate::RegisterSpec for SCK_SPEC {
99    type Ux = u32;
100}
101#[doc = "`read()` method returns [sck::R](R) reader structure"]
102impl crate::Readable for SCK_SPEC {
103    type Reader = R;
104}
105#[doc = "`write(|w| ..)` method takes [sck::W](W) writer structure"]
106impl crate::Writable for SCK_SPEC {
107    type Writer = W;
108}
109#[doc = "`reset()` method sets SCK to value 0xffff_ffff"]
110impl crate::Resettable for SCK_SPEC {
111    #[inline(always)]
112    fn reset_value() -> Self::Ux {
113        0xffff_ffff
114    }
115}