stm32f1_staging/stm32f102/uart4/
cr2.rspub type R = crate::R<CR2rs>;
pub type W = crate::W<CR2rs>;
pub type ADD_R = crate::FieldReader;
pub type ADD_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LBDL {
Lbdl10 = 0,
Lbdl11 = 1,
}
impl From<LBDL> for bool {
#[inline(always)]
fn from(variant: LBDL) -> Self {
variant as u8 != 0
}
}
pub type LBDL_R = crate::BitReader<LBDL>;
impl LBDL_R {
#[inline(always)]
pub const fn variant(&self) -> LBDL {
match self.bits {
false => LBDL::Lbdl10,
true => LBDL::Lbdl11,
}
}
#[inline(always)]
pub fn is_lbdl10(&self) -> bool {
*self == LBDL::Lbdl10
}
#[inline(always)]
pub fn is_lbdl11(&self) -> bool {
*self == LBDL::Lbdl11
}
}
pub type LBDL_W<'a, REG> = crate::BitWriter<'a, REG, LBDL>;
impl<'a, REG> LBDL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn lbdl10(self) -> &'a mut crate::W<REG> {
self.variant(LBDL::Lbdl10)
}
#[inline(always)]
pub fn lbdl11(self) -> &'a mut crate::W<REG> {
self.variant(LBDL::Lbdl11)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LBDIE {
Disabled = 0,
Enabled = 1,
}
impl From<LBDIE> for bool {
#[inline(always)]
fn from(variant: LBDIE) -> Self {
variant as u8 != 0
}
}
pub type LBDIE_R = crate::BitReader<LBDIE>;
impl LBDIE_R {
#[inline(always)]
pub const fn variant(&self) -> LBDIE {
match self.bits {
false => LBDIE::Disabled,
true => LBDIE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == LBDIE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == LBDIE::Enabled
}
}
pub type LBDIE_W<'a, REG> = crate::BitWriter<'a, REG, LBDIE>;
impl<'a, REG> LBDIE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(LBDIE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(LBDIE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum STOP {
Stop1 = 0,
Stop2 = 2,
}
impl From<STOP> for u8 {
#[inline(always)]
fn from(variant: STOP) -> Self {
variant as _
}
}
impl crate::FieldSpec for STOP {
type Ux = u8;
}
impl crate::IsEnum for STOP {}
pub type STOP_R = crate::FieldReader<STOP>;
impl STOP_R {
#[inline(always)]
pub const fn variant(&self) -> Option<STOP> {
match self.bits {
0 => Some(STOP::Stop1),
2 => Some(STOP::Stop2),
_ => None,
}
}
#[inline(always)]
pub fn is_stop1(&self) -> bool {
*self == STOP::Stop1
}
#[inline(always)]
pub fn is_stop2(&self) -> bool {
*self == STOP::Stop2
}
}
pub type STOP_W<'a, REG> = crate::FieldWriter<'a, REG, 2, STOP>;
impl<'a, REG> STOP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn stop1(self) -> &'a mut crate::W<REG> {
self.variant(STOP::Stop1)
}
#[inline(always)]
pub fn stop2(self) -> &'a mut crate::W<REG> {
self.variant(STOP::Stop2)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LINEN {
Disabled = 0,
Enabled = 1,
}
impl From<LINEN> for bool {
#[inline(always)]
fn from(variant: LINEN) -> Self {
variant as u8 != 0
}
}
pub type LINEN_R = crate::BitReader<LINEN>;
impl LINEN_R {
#[inline(always)]
pub const fn variant(&self) -> LINEN {
match self.bits {
false => LINEN::Disabled,
true => LINEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == LINEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == LINEN::Enabled
}
}
pub type LINEN_W<'a, REG> = crate::BitWriter<'a, REG, LINEN>;
impl<'a, REG> LINEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(LINEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(LINEN::Enabled)
}
}
impl R {
#[inline(always)]
pub fn add(&self) -> ADD_R {
ADD_R::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn lbdl(&self) -> LBDL_R {
LBDL_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn lbdie(&self) -> LBDIE_R {
LBDIE_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn stop(&self) -> STOP_R {
STOP_R::new(((self.bits >> 12) & 3) as u8)
}
#[inline(always)]
pub fn linen(&self) -> LINEN_R {
LINEN_R::new(((self.bits >> 14) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR2")
.field("add", &self.add())
.field("lbdl", &self.lbdl())
.field("lbdie", &self.lbdie())
.field("stop", &self.stop())
.field("linen", &self.linen())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn add(&mut self) -> ADD_W<CR2rs> {
ADD_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn lbdl(&mut self) -> LBDL_W<CR2rs> {
LBDL_W::new(self, 5)
}
#[inline(always)]
#[must_use]
pub fn lbdie(&mut self) -> LBDIE_W<CR2rs> {
LBDIE_W::new(self, 6)
}
#[inline(always)]
#[must_use]
pub fn stop(&mut self) -> STOP_W<CR2rs> {
STOP_W::new(self, 12)
}
#[inline(always)]
#[must_use]
pub fn linen(&mut self) -> LINEN_W<CR2rs> {
LINEN_W::new(self, 14)
}
}
pub struct CR2rs;
impl crate::RegisterSpec for CR2rs {
type Ux = u32;
}
impl crate::Readable for CR2rs {}
impl crate::Writable for CR2rs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for CR2rs {
const RESET_VALUE: u32 = 0;
}