pub type R = crate::R<SRrs>;
pub type W = crate::W<SRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RXNE {
Empty = 0,
NotEmpty = 1,
}
impl From<RXNE> for bool {
#[inline(always)]
fn from(variant: RXNE) -> Self {
variant as u8 != 0
}
}
pub type RXNE_R = crate::BitReader<RXNE>;
impl RXNE_R {
#[inline(always)]
pub const fn variant(&self) -> RXNE {
match self.bits {
false => RXNE::Empty,
true => RXNE::NotEmpty,
}
}
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == RXNE::Empty
}
#[inline(always)]
pub fn is_not_empty(&self) -> bool {
*self == RXNE::NotEmpty
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TXE {
NotEmpty = 0,
Empty = 1,
}
impl From<TXE> for bool {
#[inline(always)]
fn from(variant: TXE) -> Self {
variant as u8 != 0
}
}
pub type TXE_R = crate::BitReader<TXE>;
impl TXE_R {
#[inline(always)]
pub const fn variant(&self) -> TXE {
match self.bits {
false => TXE::NotEmpty,
true => TXE::Empty,
}
}
#[inline(always)]
pub fn is_not_empty(&self) -> bool {
*self == TXE::NotEmpty
}
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == TXE::Empty
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CRCERRR {
Match = 0,
NoMatch = 1,
}
impl From<CRCERRR> for bool {
#[inline(always)]
fn from(variant: CRCERRR) -> Self {
variant as u8 != 0
}
}
pub type CRCERR_R = crate::BitReader<CRCERRR>;
impl CRCERR_R {
#[inline(always)]
pub const fn variant(&self) -> CRCERRR {
match self.bits {
false => CRCERRR::Match,
true => CRCERRR::NoMatch,
}
}
#[inline(always)]
pub fn is_match(&self) -> bool {
*self == CRCERRR::Match
}
#[inline(always)]
pub fn is_no_match(&self) -> bool {
*self == CRCERRR::NoMatch
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CRCERRW {
Clear = 0,
}
impl From<CRCERRW> for bool {
#[inline(always)]
fn from(variant: CRCERRW) -> Self {
variant as u8 != 0
}
}
pub type CRCERR_W<'a, REG> = crate::BitWriter0C<'a, REG, CRCERRW>;
impl<'a, REG> CRCERR_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn clear(self) -> &'a mut crate::W<REG> {
self.variant(CRCERRW::Clear)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MODFR {
NoFault = 0,
Fault = 1,
}
impl From<MODFR> for bool {
#[inline(always)]
fn from(variant: MODFR) -> Self {
variant as u8 != 0
}
}
pub type MODF_R = crate::BitReader<MODFR>;
impl MODF_R {
#[inline(always)]
pub const fn variant(&self) -> MODFR {
match self.bits {
false => MODFR::NoFault,
true => MODFR::Fault,
}
}
#[inline(always)]
pub fn is_no_fault(&self) -> bool {
*self == MODFR::NoFault
}
#[inline(always)]
pub fn is_fault(&self) -> bool {
*self == MODFR::Fault
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OVRR {
NoOverrun = 0,
Overrun = 1,
}
impl From<OVRR> for bool {
#[inline(always)]
fn from(variant: OVRR) -> Self {
variant as u8 != 0
}
}
pub type OVR_R = crate::BitReader<OVRR>;
impl OVR_R {
#[inline(always)]
pub const fn variant(&self) -> OVRR {
match self.bits {
false => OVRR::NoOverrun,
true => OVRR::Overrun,
}
}
#[inline(always)]
pub fn is_no_overrun(&self) -> bool {
*self == OVRR::NoOverrun
}
#[inline(always)]
pub fn is_overrun(&self) -> bool {
*self == OVRR::Overrun
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BSYR {
NotBusy = 0,
Busy = 1,
}
impl From<BSYR> for bool {
#[inline(always)]
fn from(variant: BSYR) -> Self {
variant as u8 != 0
}
}
pub type BSY_R = crate::BitReader<BSYR>;
impl BSY_R {
#[inline(always)]
pub const fn variant(&self) -> BSYR {
match self.bits {
false => BSYR::NotBusy,
true => BSYR::Busy,
}
}
#[inline(always)]
pub fn is_not_busy(&self) -> bool {
*self == BSYR::NotBusy
}
#[inline(always)]
pub fn is_busy(&self) -> bool {
*self == BSYR::Busy
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FRER {
NoError = 0,
Error = 1,
}
impl From<FRER> for bool {
#[inline(always)]
fn from(variant: FRER) -> Self {
variant as u8 != 0
}
}
pub type FRE_R = crate::BitReader<FRER>;
impl FRE_R {
#[inline(always)]
pub const fn variant(&self) -> FRER {
match self.bits {
false => FRER::NoError,
true => FRER::Error,
}
}
#[inline(always)]
pub fn is_no_error(&self) -> bool {
*self == FRER::NoError
}
#[inline(always)]
pub fn is_error(&self) -> bool {
*self == FRER::Error
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FRLVLR {
Empty = 0,
Quarter = 1,
Half = 2,
Full = 3,
}
impl From<FRLVLR> for u8 {
#[inline(always)]
fn from(variant: FRLVLR) -> Self {
variant as _
}
}
impl crate::FieldSpec for FRLVLR {
type Ux = u8;
}
impl crate::IsEnum for FRLVLR {}
pub type FRLVL_R = crate::FieldReader<FRLVLR>;
impl FRLVL_R {
#[inline(always)]
pub const fn variant(&self) -> FRLVLR {
match self.bits {
0 => FRLVLR::Empty,
1 => FRLVLR::Quarter,
2 => FRLVLR::Half,
3 => FRLVLR::Full,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == FRLVLR::Empty
}
#[inline(always)]
pub fn is_quarter(&self) -> bool {
*self == FRLVLR::Quarter
}
#[inline(always)]
pub fn is_half(&self) -> bool {
*self == FRLVLR::Half
}
#[inline(always)]
pub fn is_full(&self) -> bool {
*self == FRLVLR::Full
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum FTLVLR {
Empty = 0,
Quarter = 1,
Half = 2,
Full = 3,
}
impl From<FTLVLR> for u8 {
#[inline(always)]
fn from(variant: FTLVLR) -> Self {
variant as _
}
}
impl crate::FieldSpec for FTLVLR {
type Ux = u8;
}
impl crate::IsEnum for FTLVLR {}
pub type FTLVL_R = crate::FieldReader<FTLVLR>;
impl FTLVL_R {
#[inline(always)]
pub const fn variant(&self) -> FTLVLR {
match self.bits {
0 => FTLVLR::Empty,
1 => FTLVLR::Quarter,
2 => FTLVLR::Half,
3 => FTLVLR::Full,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == FTLVLR::Empty
}
#[inline(always)]
pub fn is_quarter(&self) -> bool {
*self == FTLVLR::Quarter
}
#[inline(always)]
pub fn is_half(&self) -> bool {
*self == FTLVLR::Half
}
#[inline(always)]
pub fn is_full(&self) -> bool {
*self == FTLVLR::Full
}
}
impl R {
#[inline(always)]
pub fn rxne(&self) -> RXNE_R {
RXNE_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn txe(&self) -> TXE_R {
TXE_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn crcerr(&self) -> CRCERR_R {
CRCERR_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn modf(&self) -> MODF_R {
MODF_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn ovr(&self) -> OVR_R {
OVR_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn bsy(&self) -> BSY_R {
BSY_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn fre(&self) -> FRE_R {
FRE_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn frlvl(&self) -> FRLVL_R {
FRLVL_R::new(((self.bits >> 9) & 3) as u8)
}
#[inline(always)]
pub fn ftlvl(&self) -> FTLVL_R {
FTLVL_R::new(((self.bits >> 11) & 3) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SR")
.field("rxne", &self.rxne())
.field("txe", &self.txe())
.field("crcerr", &self.crcerr())
.field("modf", &self.modf())
.field("ovr", &self.ovr())
.field("bsy", &self.bsy())
.field("fre", &self.fre())
.field("frlvl", &self.frlvl())
.field("ftlvl", &self.ftlvl())
.finish()
}
}
impl W {
#[inline(always)]
pub fn crcerr(&mut self) -> CRCERR_W<SRrs> {
CRCERR_W::new(self, 4)
}
}
pub struct SRrs;
impl crate::RegisterSpec for SRrs {
type Ux = u16;
}
impl crate::Readable for SRrs {}
impl crate::Writable for SRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0x10;
}
impl crate::Resettable for SRrs {
const RESET_VALUE: u16 = 0x02;
}