ra2e1/sysc/
hocowtcr.rs

1#[doc = "Register `HOCOWTCR` reader"]
2pub struct R(crate::R<HOCOWTCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<HOCOWTCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<HOCOWTCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<HOCOWTCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `HOCOWTCR` writer"]
17pub struct W(crate::W<HOCOWTCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<HOCOWTCR_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<HOCOWTCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<HOCOWTCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `HSTS` reader - HOCO Wait Time Setting"]
38pub type HSTS_R = crate::FieldReader<u8, HSTS_A>;
39#[doc = "HOCO Wait Time Setting\n\nValue on reset: 5"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum HSTS_A {
43    #[doc = "5: Value after reset."]
44    _101 = 5,
45    #[doc = "3: Before starting high-speed on-chip oscillator by setting HOCOCR.HCSTP bit, the HSTS\\[2:0\\]
46bits must be set to 011b beforehand. Wait time = 46 cycles (5.75 µs) Wait time is calculated at MOCO = 8 MHz (typically 0.125 µs)."]
47    _011 = 3,
48}
49impl From<HSTS_A> for u8 {
50    #[inline(always)]
51    fn from(variant: HSTS_A) -> Self {
52        variant as _
53    }
54}
55impl HSTS_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub fn variant(&self) -> Option<HSTS_A> {
59        match self.bits {
60            5 => Some(HSTS_A::_101),
61            3 => Some(HSTS_A::_011),
62            _ => None,
63        }
64    }
65    #[doc = "Checks if the value of the field is `_101`"]
66    #[inline(always)]
67    pub fn is_101(&self) -> bool {
68        *self == HSTS_A::_101
69    }
70    #[doc = "Checks if the value of the field is `_011`"]
71    #[inline(always)]
72    pub fn is_011(&self) -> bool {
73        *self == HSTS_A::_011
74    }
75}
76#[doc = "Field `HSTS` writer - HOCO Wait Time Setting"]
77pub type HSTS_W<'a, const O: u8> = crate::FieldWriter<'a, u8, HOCOWTCR_SPEC, u8, HSTS_A, 3, O>;
78impl<'a, const O: u8> HSTS_W<'a, O> {
79    #[doc = "Value after reset."]
80    #[inline(always)]
81    pub fn _101(self) -> &'a mut W {
82        self.variant(HSTS_A::_101)
83    }
84    #[doc = "Before starting high-speed on-chip oscillator by setting HOCOCR.HCSTP bit, the HSTS\\[2:0\\]
85bits must be set to 011b beforehand. Wait time = 46 cycles (5.75 µs) Wait time is calculated at MOCO = 8 MHz (typically 0.125 µs)."]
86    #[inline(always)]
87    pub fn _011(self) -> &'a mut W {
88        self.variant(HSTS_A::_011)
89    }
90}
91impl R {
92    #[doc = "Bits 0:2 - HOCO Wait Time Setting"]
93    #[inline(always)]
94    pub fn hsts(&self) -> HSTS_R {
95        HSTS_R::new(self.bits & 7)
96    }
97}
98impl W {
99    #[doc = "Bits 0:2 - HOCO Wait Time Setting"]
100    #[inline(always)]
101    #[must_use]
102    pub fn hsts(&mut self) -> HSTS_W<0> {
103        HSTS_W::new(self)
104    }
105    #[doc = "Writes raw bits to the register."]
106    #[inline(always)]
107    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
108        self.0.bits(bits);
109        self
110    }
111}
112#[doc = "High-Speed On-Chip Oscillator Wait Control Register\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 [hocowtcr](index.html) module"]
113pub struct HOCOWTCR_SPEC;
114impl crate::RegisterSpec for HOCOWTCR_SPEC {
115    type Ux = u8;
116}
117#[doc = "`read()` method returns [hocowtcr::R](R) reader structure"]
118impl crate::Readable for HOCOWTCR_SPEC {
119    type Reader = R;
120}
121#[doc = "`write(|w| ..)` method takes [hocowtcr::W](W) writer structure"]
122impl crate::Writable for HOCOWTCR_SPEC {
123    type Writer = W;
124    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
125    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
126}
127#[doc = "`reset()` method sets HOCOWTCR to value 0x05"]
128impl crate::Resettable for HOCOWTCR_SPEC {
129    const RESET_VALUE: Self::Ux = 0x05;
130}