#[doc = "Register `CSR` reader"]
pub struct R(crate::R<CSR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CSR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CSR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CSR_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CSR` writer"]
pub struct W(crate::W<CSR_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CSR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<CSR_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CSR_SPEC>) -> Self {
W(writer)
}
}
#[doc = "LSI oscillator enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSION_A {
#[doc = "0: LSI oscillator Off"]
Off = 0,
#[doc = "1: LSI oscillator On"]
On = 1,
}
impl From<LSION_A> for bool {
#[inline(always)]
fn from(variant: LSION_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `LSION` reader - LSI oscillator enable"]
pub type LSION_R = crate::BitReader<LSION_A>;
impl LSION_R {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LSION_A {
match self.bits {
false => LSION_A::Off,
true => LSION_A::On,
}
}
#[doc = "Checks if the value of the field is `Off`"]
#[inline(always)]
pub fn is_off(&self) -> bool {
*self == LSION_A::Off
}
#[doc = "Checks if the value of the field is `On`"]
#[inline(always)]
pub fn is_on(&self) -> bool {
*self == LSION_A::On
}
}
#[doc = "Field `LSION` writer - LSI oscillator enable"]
pub type LSION_W<'a, const O: u8> = crate::BitWriter<'a, u32, CSR_SPEC, LSION_A, O>;
impl<'a, const O: u8> LSION_W<'a, O> {
#[doc = "LSI oscillator Off"]
#[inline(always)]
pub fn off(self) -> &'a mut W {
self.variant(LSION_A::Off)
}
#[doc = "LSI oscillator On"]
#[inline(always)]
pub fn on(self) -> &'a mut W {
self.variant(LSION_A::On)
}
}
#[doc = "LSI oscillator ready\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LSIRDY_A {
#[doc = "0: LSI oscillator not ready"]
NotReady = 0,
#[doc = "1: LSI oscillator ready"]
Ready = 1,
}
impl From<LSIRDY_A> for bool {
#[inline(always)]
fn from(variant: LSIRDY_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `LSIRDY` reader - LSI oscillator ready"]
pub type LSIRDY_R = crate::BitReader<LSIRDY_A>;
impl LSIRDY_R {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LSIRDY_A {
match self.bits {
false => LSIRDY_A::NotReady,
true => LSIRDY_A::Ready,
}
}
#[doc = "Checks if the value of the field is `NotReady`"]
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == LSIRDY_A::NotReady
}
#[doc = "Checks if the value of the field is `Ready`"]
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == LSIRDY_A::Ready
}
}
#[doc = "Field `LSIRDY` writer - LSI oscillator ready"]
pub type LSIRDY_W<'a, const O: u8> = crate::BitWriter<'a, u32, CSR_SPEC, LSIRDY_A, O>;
impl<'a, const O: u8> LSIRDY_W<'a, O> {
#[doc = "LSI oscillator not ready"]
#[inline(always)]
pub fn not_ready(self) -> &'a mut W {
self.variant(LSIRDY_A::NotReady)
}
#[doc = "LSI oscillator ready"]
#[inline(always)]
pub fn ready(self) -> &'a mut W {
self.variant(LSIRDY_A::Ready)
}
}
impl R {
#[doc = "Bit 0 - LSI oscillator enable"]
#[inline(always)]
pub fn lsion(&self) -> LSION_R {
LSION_R::new((self.bits & 1) != 0)
}
#[doc = "Bit 1 - LSI oscillator ready"]
#[inline(always)]
pub fn lsirdy(&self) -> LSIRDY_R {
LSIRDY_R::new(((self.bits >> 1) & 1) != 0)
}
}
impl W {
#[doc = "Bit 0 - LSI oscillator enable"]
#[inline(always)]
pub fn lsion(&mut self) -> LSION_W<0> {
LSION_W::new(self)
}
#[doc = "Bit 1 - LSI oscillator ready"]
#[inline(always)]
pub fn lsirdy(&mut self) -> LSIRDY_W<1> {
LSIRDY_W::new(self)
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "RCC Clock Control and Status 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 [csr](index.html) module"]
pub struct CSR_SPEC;
impl crate::RegisterSpec for CSR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [csr::R](R) reader structure"]
impl crate::Readable for CSR_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [csr::W](W) writer structure"]
impl crate::Writable for CSR_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CSR to value 0"]
impl crate::Resettable for CSR_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}