stm32f1_staging/stm32f103/i2c1/
cr2.rspub type R = crate::R<CR2rs>;
pub type W = crate::W<CR2rs>;
pub type FREQ_R = crate::FieldReader;
pub type FREQ_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ITERREN {
Disabled = 0,
Enabled = 1,
}
impl From<ITERREN> for bool {
#[inline(always)]
fn from(variant: ITERREN) -> Self {
variant as u8 != 0
}
}
pub type ITERREN_R = crate::BitReader<ITERREN>;
impl ITERREN_R {
#[inline(always)]
pub const fn variant(&self) -> ITERREN {
match self.bits {
false => ITERREN::Disabled,
true => ITERREN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ITERREN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ITERREN::Enabled
}
}
pub type ITERREN_W<'a, REG> = crate::BitWriter<'a, REG, ITERREN>;
impl<'a, REG> ITERREN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ITERREN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ITERREN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ITEVTEN {
Disabled = 0,
Enabled = 1,
}
impl From<ITEVTEN> for bool {
#[inline(always)]
fn from(variant: ITEVTEN) -> Self {
variant as u8 != 0
}
}
pub type ITEVTEN_R = crate::BitReader<ITEVTEN>;
impl ITEVTEN_R {
#[inline(always)]
pub const fn variant(&self) -> ITEVTEN {
match self.bits {
false => ITEVTEN::Disabled,
true => ITEVTEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ITEVTEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ITEVTEN::Enabled
}
}
pub type ITEVTEN_W<'a, REG> = crate::BitWriter<'a, REG, ITEVTEN>;
impl<'a, REG> ITEVTEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ITEVTEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ITEVTEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ITBUFEN {
Disabled = 0,
Enabled = 1,
}
impl From<ITBUFEN> for bool {
#[inline(always)]
fn from(variant: ITBUFEN) -> Self {
variant as u8 != 0
}
}
pub type ITBUFEN_R = crate::BitReader<ITBUFEN>;
impl ITBUFEN_R {
#[inline(always)]
pub const fn variant(&self) -> ITBUFEN {
match self.bits {
false => ITBUFEN::Disabled,
true => ITBUFEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ITBUFEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ITBUFEN::Enabled
}
}
pub type ITBUFEN_W<'a, REG> = crate::BitWriter<'a, REG, ITBUFEN>;
impl<'a, REG> ITBUFEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ITBUFEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ITBUFEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAEN {
Disabled = 0,
Enabled = 1,
}
impl From<DMAEN> for bool {
#[inline(always)]
fn from(variant: DMAEN) -> Self {
variant as u8 != 0
}
}
pub type DMAEN_R = crate::BitReader<DMAEN>;
impl DMAEN_R {
#[inline(always)]
pub const fn variant(&self) -> DMAEN {
match self.bits {
false => DMAEN::Disabled,
true => DMAEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMAEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMAEN::Enabled
}
}
pub type DMAEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAEN>;
impl<'a, REG> DMAEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LAST {
NotLast = 0,
Last = 1,
}
impl From<LAST> for bool {
#[inline(always)]
fn from(variant: LAST) -> Self {
variant as u8 != 0
}
}
pub type LAST_R = crate::BitReader<LAST>;
impl LAST_R {
#[inline(always)]
pub const fn variant(&self) -> LAST {
match self.bits {
false => LAST::NotLast,
true => LAST::Last,
}
}
#[inline(always)]
pub fn is_not_last(&self) -> bool {
*self == LAST::NotLast
}
#[inline(always)]
pub fn is_last(&self) -> bool {
*self == LAST::Last
}
}
pub type LAST_W<'a, REG> = crate::BitWriter<'a, REG, LAST>;
impl<'a, REG> LAST_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_last(self) -> &'a mut crate::W<REG> {
self.variant(LAST::NotLast)
}
#[inline(always)]
pub fn last(self) -> &'a mut crate::W<REG> {
self.variant(LAST::Last)
}
}
impl R {
#[inline(always)]
pub fn freq(&self) -> FREQ_R {
FREQ_R::new((self.bits & 0x3f) as u8)
}
#[inline(always)]
pub fn iterren(&self) -> ITERREN_R {
ITERREN_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn itevten(&self) -> ITEVTEN_R {
ITEVTEN_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn itbufen(&self) -> ITBUFEN_R {
ITBUFEN_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn dmaen(&self) -> DMAEN_R {
DMAEN_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn last(&self) -> LAST_R {
LAST_R::new(((self.bits >> 12) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR2")
.field("last", &self.last())
.field("dmaen", &self.dmaen())
.field("itbufen", &self.itbufen())
.field("itevten", &self.itevten())
.field("iterren", &self.iterren())
.field("freq", &self.freq())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn freq(&mut self) -> FREQ_W<CR2rs> {
FREQ_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn iterren(&mut self) -> ITERREN_W<CR2rs> {
ITERREN_W::new(self, 8)
}
#[inline(always)]
#[must_use]
pub fn itevten(&mut self) -> ITEVTEN_W<CR2rs> {
ITEVTEN_W::new(self, 9)
}
#[inline(always)]
#[must_use]
pub fn itbufen(&mut self) -> ITBUFEN_W<CR2rs> {
ITBUFEN_W::new(self, 10)
}
#[inline(always)]
#[must_use]
pub fn dmaen(&mut self) -> DMAEN_W<CR2rs> {
DMAEN_W::new(self, 11)
}
#[inline(always)]
#[must_use]
pub fn last(&mut self) -> LAST_W<CR2rs> {
LAST_W::new(self, 12)
}
}
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;
}