pub type R = crate::R<BMCRrs>;
pub type W = crate::W<BMCRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BME {
Disabled = 0,
Enabled = 1,
}
impl From<BME> for bool {
#[inline(always)]
fn from(variant: BME) -> Self {
variant as u8 != 0
}
}
pub type BME_R = crate::BitReader<BME>;
impl BME_R {
#[inline(always)]
pub const fn variant(&self) -> BME {
match self.bits {
false => BME::Disabled,
true => BME::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == BME::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == BME::Enabled
}
}
pub type BME_W<'a, REG> = crate::BitWriter<'a, REG, BME>;
impl<'a, REG> BME_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(BME::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(BME::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BMOM {
SingleShot = 0,
Continuous = 1,
}
impl From<BMOM> for bool {
#[inline(always)]
fn from(variant: BMOM) -> Self {
variant as u8 != 0
}
}
pub type BMOM_R = crate::BitReader<BMOM>;
impl BMOM_R {
#[inline(always)]
pub const fn variant(&self) -> BMOM {
match self.bits {
false => BMOM::SingleShot,
true => BMOM::Continuous,
}
}
#[inline(always)]
pub fn is_single_shot(&self) -> bool {
*self == BMOM::SingleShot
}
#[inline(always)]
pub fn is_continuous(&self) -> bool {
*self == BMOM::Continuous
}
}
pub type BMOM_W<'a, REG> = crate::BitWriter<'a, REG, BMOM>;
impl<'a, REG> BMOM_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn single_shot(self) -> &'a mut crate::W<REG> {
self.variant(BMOM::SingleShot)
}
#[inline(always)]
pub fn continuous(self) -> &'a mut crate::W<REG> {
self.variant(BMOM::Continuous)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum BMCLK {
Master = 0,
TimerA = 1,
TimerB = 2,
TimerC = 3,
TimerD = 4,
TimerE = 5,
Event1 = 6,
Event2 = 7,
Event3 = 8,
Event4 = 9,
Clock = 10,
}
impl From<BMCLK> for u8 {
#[inline(always)]
fn from(variant: BMCLK) -> Self {
variant as _
}
}
impl crate::FieldSpec for BMCLK {
type Ux = u8;
}
impl crate::IsEnum for BMCLK {}
pub type BMCLK_R = crate::FieldReader<BMCLK>;
impl BMCLK_R {
#[inline(always)]
pub const fn variant(&self) -> Option<BMCLK> {
match self.bits {
0 => Some(BMCLK::Master),
1 => Some(BMCLK::TimerA),
2 => Some(BMCLK::TimerB),
3 => Some(BMCLK::TimerC),
4 => Some(BMCLK::TimerD),
5 => Some(BMCLK::TimerE),
6 => Some(BMCLK::Event1),
7 => Some(BMCLK::Event2),
8 => Some(BMCLK::Event3),
9 => Some(BMCLK::Event4),
10 => Some(BMCLK::Clock),
_ => None,
}
}
#[inline(always)]
pub fn is_master(&self) -> bool {
*self == BMCLK::Master
}
#[inline(always)]
pub fn is_timer_a(&self) -> bool {
*self == BMCLK::TimerA
}
#[inline(always)]
pub fn is_timer_b(&self) -> bool {
*self == BMCLK::TimerB
}
#[inline(always)]
pub fn is_timer_c(&self) -> bool {
*self == BMCLK::TimerC
}
#[inline(always)]
pub fn is_timer_d(&self) -> bool {
*self == BMCLK::TimerD
}
#[inline(always)]
pub fn is_timer_e(&self) -> bool {
*self == BMCLK::TimerE
}
#[inline(always)]
pub fn is_event1(&self) -> bool {
*self == BMCLK::Event1
}
#[inline(always)]
pub fn is_event2(&self) -> bool {
*self == BMCLK::Event2
}
#[inline(always)]
pub fn is_event3(&self) -> bool {
*self == BMCLK::Event3
}
#[inline(always)]
pub fn is_event4(&self) -> bool {
*self == BMCLK::Event4
}
#[inline(always)]
pub fn is_clock(&self) -> bool {
*self == BMCLK::Clock
}
}
pub type BMCLK_W<'a, REG> = crate::FieldWriter<'a, REG, 4, BMCLK>;
impl<'a, REG> BMCLK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn master(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::Master)
}
#[inline(always)]
pub fn timer_a(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::TimerA)
}
#[inline(always)]
pub fn timer_b(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::TimerB)
}
#[inline(always)]
pub fn timer_c(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::TimerC)
}
#[inline(always)]
pub fn timer_d(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::TimerD)
}
#[inline(always)]
pub fn timer_e(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::TimerE)
}
#[inline(always)]
pub fn event1(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::Event1)
}
#[inline(always)]
pub fn event2(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::Event2)
}
#[inline(always)]
pub fn event3(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::Event3)
}
#[inline(always)]
pub fn event4(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::Event4)
}
#[inline(always)]
pub fn clock(self) -> &'a mut crate::W<REG> {
self.variant(BMCLK::Clock)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum BMPRSC {
Div1 = 0,
Div2 = 1,
Div4 = 2,
Div8 = 3,
Div16 = 4,
Div32 = 5,
Div64 = 6,
Div128 = 7,
Div256 = 8,
Div512 = 9,
Div1024 = 10,
Div2048 = 11,
Div4096 = 12,
Div8192 = 13,
Div16384 = 14,
Div32768 = 15,
}
impl From<BMPRSC> for u8 {
#[inline(always)]
fn from(variant: BMPRSC) -> Self {
variant as _
}
}
impl crate::FieldSpec for BMPRSC {
type Ux = u8;
}
impl crate::IsEnum for BMPRSC {}
pub type BMPRSC_R = crate::FieldReader<BMPRSC>;
impl BMPRSC_R {
#[inline(always)]
pub const fn variant(&self) -> BMPRSC {
match self.bits {
0 => BMPRSC::Div1,
1 => BMPRSC::Div2,
2 => BMPRSC::Div4,
3 => BMPRSC::Div8,
4 => BMPRSC::Div16,
5 => BMPRSC::Div32,
6 => BMPRSC::Div64,
7 => BMPRSC::Div128,
8 => BMPRSC::Div256,
9 => BMPRSC::Div512,
10 => BMPRSC::Div1024,
11 => BMPRSC::Div2048,
12 => BMPRSC::Div4096,
13 => BMPRSC::Div8192,
14 => BMPRSC::Div16384,
15 => BMPRSC::Div32768,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == BMPRSC::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == BMPRSC::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == BMPRSC::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == BMPRSC::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == BMPRSC::Div16
}
#[inline(always)]
pub fn is_div32(&self) -> bool {
*self == BMPRSC::Div32
}
#[inline(always)]
pub fn is_div64(&self) -> bool {
*self == BMPRSC::Div64
}
#[inline(always)]
pub fn is_div128(&self) -> bool {
*self == BMPRSC::Div128
}
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == BMPRSC::Div256
}
#[inline(always)]
pub fn is_div512(&self) -> bool {
*self == BMPRSC::Div512
}
#[inline(always)]
pub fn is_div1024(&self) -> bool {
*self == BMPRSC::Div1024
}
#[inline(always)]
pub fn is_div2048(&self) -> bool {
*self == BMPRSC::Div2048
}
#[inline(always)]
pub fn is_div4096(&self) -> bool {
*self == BMPRSC::Div4096
}
#[inline(always)]
pub fn is_div8192(&self) -> bool {
*self == BMPRSC::Div8192
}
#[inline(always)]
pub fn is_div16384(&self) -> bool {
*self == BMPRSC::Div16384
}
#[inline(always)]
pub fn is_div32768(&self) -> bool {
*self == BMPRSC::Div32768
}
}
pub type BMPRSC_W<'a, REG> = crate::FieldWriter<'a, REG, 4, BMPRSC, crate::Safe>;
impl<'a, REG> BMPRSC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div16)
}
#[inline(always)]
pub fn div32(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div32)
}
#[inline(always)]
pub fn div64(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div64)
}
#[inline(always)]
pub fn div128(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div128)
}
#[inline(always)]
pub fn div256(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div256)
}
#[inline(always)]
pub fn div512(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div512)
}
#[inline(always)]
pub fn div1024(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div1024)
}
#[inline(always)]
pub fn div2048(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div2048)
}
#[inline(always)]
pub fn div4096(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div4096)
}
#[inline(always)]
pub fn div8192(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div8192)
}
#[inline(always)]
pub fn div16384(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div16384)
}
#[inline(always)]
pub fn div32768(self) -> &'a mut crate::W<REG> {
self.variant(BMPRSC::Div32768)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BMPREN {
Disabled = 0,
Enabled = 1,
}
impl From<BMPREN> for bool {
#[inline(always)]
fn from(variant: BMPREN) -> Self {
variant as u8 != 0
}
}
pub type BMPREN_R = crate::BitReader<BMPREN>;
impl BMPREN_R {
#[inline(always)]
pub const fn variant(&self) -> BMPREN {
match self.bits {
false => BMPREN::Disabled,
true => BMPREN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == BMPREN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == BMPREN::Enabled
}
}
pub type BMPREN_W<'a, REG> = crate::BitWriter<'a, REG, BMPREN>;
impl<'a, REG> BMPREN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(BMPREN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(BMPREN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MTBM {
Normal = 0,
Stopped = 1,
}
impl From<MTBM> for bool {
#[inline(always)]
fn from(variant: MTBM) -> Self {
variant as u8 != 0
}
}
pub type MTBM_R = crate::BitReader<MTBM>;
impl MTBM_R {
#[inline(always)]
pub const fn variant(&self) -> MTBM {
match self.bits {
false => MTBM::Normal,
true => MTBM::Stopped,
}
}
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == MTBM::Normal
}
#[inline(always)]
pub fn is_stopped(&self) -> bool {
*self == MTBM::Stopped
}
}
pub type MTBM_W<'a, REG> = crate::BitWriter<'a, REG, MTBM>;
impl<'a, REG> MTBM_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn normal(self) -> &'a mut crate::W<REG> {
self.variant(MTBM::Normal)
}
#[inline(always)]
pub fn stopped(self) -> &'a mut crate::W<REG> {
self.variant(MTBM::Stopped)
}
}
pub use MTBM_R as TBM_R;
pub use MTBM_W as TBM_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BMSTATR {
Normal = 0,
Burst = 1,
}
impl From<BMSTATR> for bool {
#[inline(always)]
fn from(variant: BMSTATR) -> Self {
variant as u8 != 0
}
}
pub type BMSTAT_R = crate::BitReader<BMSTATR>;
impl BMSTAT_R {
#[inline(always)]
pub const fn variant(&self) -> BMSTATR {
match self.bits {
false => BMSTATR::Normal,
true => BMSTATR::Burst,
}
}
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == BMSTATR::Normal
}
#[inline(always)]
pub fn is_burst(&self) -> bool {
*self == BMSTATR::Burst
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BMSTATW {
Cancel = 0,
}
impl From<BMSTATW> for bool {
#[inline(always)]
fn from(variant: BMSTATW) -> Self {
variant as u8 != 0
}
}
pub type BMSTAT_W<'a, REG> = crate::BitWriter0C<'a, REG, BMSTATW>;
impl<'a, REG> BMSTAT_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn cancel(self) -> &'a mut crate::W<REG> {
self.variant(BMSTATW::Cancel)
}
}
impl R {
#[inline(always)]
pub fn bme(&self) -> BME_R {
BME_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn bmom(&self) -> BMOM_R {
BMOM_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn bmclk(&self) -> BMCLK_R {
BMCLK_R::new(((self.bits >> 2) & 0x0f) as u8)
}
#[inline(always)]
pub fn bmprsc(&self) -> BMPRSC_R {
BMPRSC_R::new(((self.bits >> 6) & 0x0f) as u8)
}
#[inline(always)]
pub fn bmpren(&self) -> BMPREN_R {
BMPREN_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn mtbm(&self) -> MTBM_R {
MTBM_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn tbm(&self, n: u8) -> TBM_R {
#[allow(clippy::no_effect)] [(); 5][n as usize];
TBM_R::new(((self.bits >> (n + 17)) & 1) != 0)
}
#[inline(always)]
pub fn tbm_iter(&self) -> impl Iterator<Item = TBM_R> + '_ {
(0..5).map(move |n| TBM_R::new(((self.bits >> (n + 17)) & 1) != 0))
}
#[inline(always)]
pub fn tabm(&self) -> TBM_R {
TBM_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn tbbm(&self) -> TBM_R {
TBM_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn tcbm(&self) -> TBM_R {
TBM_R::new(((self.bits >> 19) & 1) != 0)
}
#[inline(always)]
pub fn tdbm(&self) -> TBM_R {
TBM_R::new(((self.bits >> 20) & 1) != 0)
}
#[inline(always)]
pub fn tebm(&self) -> TBM_R {
TBM_R::new(((self.bits >> 21) & 1) != 0)
}
#[inline(always)]
pub fn bmstat(&self) -> BMSTAT_R {
BMSTAT_R::new(((self.bits >> 31) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("BMCR")
.field("bmstat", &self.bmstat())
.field("mtbm", &self.mtbm())
.field("tabm", &self.tabm())
.field("tbbm", &self.tbbm())
.field("tcbm", &self.tcbm())
.field("tdbm", &self.tdbm())
.field("tebm", &self.tebm())
.field("bmpren", &self.bmpren())
.field("bmprsc", &self.bmprsc())
.field("bmclk", &self.bmclk())
.field("bmom", &self.bmom())
.field("bme", &self.bme())
.finish()
}
}
impl W {
#[inline(always)]
pub fn bme(&mut self) -> BME_W<BMCRrs> {
BME_W::new(self, 0)
}
#[inline(always)]
pub fn bmom(&mut self) -> BMOM_W<BMCRrs> {
BMOM_W::new(self, 1)
}
#[inline(always)]
pub fn bmclk(&mut self) -> BMCLK_W<BMCRrs> {
BMCLK_W::new(self, 2)
}
#[inline(always)]
pub fn bmprsc(&mut self) -> BMPRSC_W<BMCRrs> {
BMPRSC_W::new(self, 6)
}
#[inline(always)]
pub fn bmpren(&mut self) -> BMPREN_W<BMCRrs> {
BMPREN_W::new(self, 10)
}
#[inline(always)]
pub fn mtbm(&mut self) -> MTBM_W<BMCRrs> {
MTBM_W::new(self, 16)
}
#[inline(always)]
pub fn tbm(&mut self, n: u8) -> TBM_W<BMCRrs> {
#[allow(clippy::no_effect)] [(); 5][n as usize];
TBM_W::new(self, n + 17)
}
#[inline(always)]
pub fn tabm(&mut self) -> TBM_W<BMCRrs> {
TBM_W::new(self, 17)
}
#[inline(always)]
pub fn tbbm(&mut self) -> TBM_W<BMCRrs> {
TBM_W::new(self, 18)
}
#[inline(always)]
pub fn tcbm(&mut self) -> TBM_W<BMCRrs> {
TBM_W::new(self, 19)
}
#[inline(always)]
pub fn tdbm(&mut self) -> TBM_W<BMCRrs> {
TBM_W::new(self, 20)
}
#[inline(always)]
pub fn tebm(&mut self) -> TBM_W<BMCRrs> {
TBM_W::new(self, 21)
}
#[inline(always)]
pub fn bmstat(&mut self) -> BMSTAT_W<BMCRrs> {
BMSTAT_W::new(self, 31)
}
}
pub struct BMCRrs;
impl crate::RegisterSpec for BMCRrs {
type Ux = u32;
}
impl crate::Readable for BMCRrs {}
impl crate::Writable for BMCRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0x8000_0000;
}
impl crate::Resettable for BMCRrs {}