stm32f1_staging/stm32f102/spi2/
sr.rspub 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
}
}
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)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SR")
.field("bsy", &self.bsy())
.field("ovr", &self.ovr())
.field("modf", &self.modf())
.field("crcerr", &self.crcerr())
.field("txe", &self.txe())
.field("rxne", &self.rxne())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
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;
const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
}
impl crate::Resettable for SRrs {
const RESET_VALUE: u16 = 0x02;
}