#[doc = "Register `SR` reader"]
pub struct R(crate::R<SR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<SR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<SR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<SR_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `SR` writer"]
pub struct W(crate::W<SR_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<SR_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<SR_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<SR_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `RXNE` reader - desc RXNE"]
pub type RXNE_R = crate::BitReader<bool>;
#[doc = "Field `TXE` reader - desc TXE"]
pub type TXE_R = crate::BitReader<bool>;
#[doc = "Field `CHSIDE` reader - desc CHSIDE"]
pub type CHSIDE_R = crate::BitReader<bool>;
#[doc = "Field `UDR` reader - desc UDR"]
pub type UDR_R = crate::BitReader<bool>;
#[doc = "Field `CRCERR` reader - desc CRCERR"]
pub type CRCERR_R = crate::BitReader<bool>;
#[doc = "Field `CRCERR` writer - desc CRCERR"]
pub type CRCERR_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, bool, O>;
#[doc = "Field `MODF` reader - desc MODF"]
pub type MODF_R = crate::BitReader<bool>;
#[doc = "Field `OVR` reader - desc OVR"]
pub type OVR_R = crate::BitReader<bool>;
#[doc = "Field `BSY` reader - desc BSY"]
pub type BSY_R = crate::BitReader<bool>;
#[doc = "Field `FRLVL` reader - desc FRLVL"]
pub type FRLVL_R = crate::FieldReader<u8, u8>;
#[doc = "Field `FTLVL` reader - desc FTLVL"]
pub type FTLVL_R = crate::FieldReader<u8, u8>;
impl R {
#[doc = "Bit 0 - desc RXNE"]
#[inline(always)]
pub fn rxne(&self) -> RXNE_R {
RXNE_R::new((self.bits & 1) != 0)
}
#[doc = "Bit 1 - desc TXE"]
#[inline(always)]
pub fn txe(&self) -> TXE_R {
TXE_R::new(((self.bits >> 1) & 1) != 0)
}
#[doc = "Bit 2 - desc CHSIDE"]
#[inline(always)]
pub fn chside(&self) -> CHSIDE_R {
CHSIDE_R::new(((self.bits >> 2) & 1) != 0)
}
#[doc = "Bit 3 - desc UDR"]
#[inline(always)]
pub fn udr(&self) -> UDR_R {
UDR_R::new(((self.bits >> 3) & 1) != 0)
}
#[doc = "Bit 4 - desc CRCERR"]
#[inline(always)]
pub fn crcerr(&self) -> CRCERR_R {
CRCERR_R::new(((self.bits >> 4) & 1) != 0)
}
#[doc = "Bit 5 - desc MODF"]
#[inline(always)]
pub fn modf(&self) -> MODF_R {
MODF_R::new(((self.bits >> 5) & 1) != 0)
}
#[doc = "Bit 6 - desc OVR"]
#[inline(always)]
pub fn ovr(&self) -> OVR_R {
OVR_R::new(((self.bits >> 6) & 1) != 0)
}
#[doc = "Bit 7 - desc BSY"]
#[inline(always)]
pub fn bsy(&self) -> BSY_R {
BSY_R::new(((self.bits >> 7) & 1) != 0)
}
#[doc = "Bits 9:10 - desc FRLVL"]
#[inline(always)]
pub fn frlvl(&self) -> FRLVL_R {
FRLVL_R::new(((self.bits >> 9) & 3) as u8)
}
#[doc = "Bits 11:12 - desc FTLVL"]
#[inline(always)]
pub fn ftlvl(&self) -> FTLVL_R {
FTLVL_R::new(((self.bits >> 11) & 3) as u8)
}
}
impl W {
#[doc = "Bit 4 - desc CRCERR"]
#[inline(always)]
pub fn crcerr(&mut self) -> CRCERR_W<4> {
CRCERR_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 = "desc SR\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 [sr](index.html) module"]
pub struct SR_SPEC;
impl crate::RegisterSpec for SR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [sr::R](R) reader structure"]
impl crate::Readable for SR_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [sr::W](W) writer structure"]
impl crate::Writable for SR_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets SR to value 0x02"]
impl crate::Resettable for SR_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0x02
}
}