pub type R = crate::R<CFGR2rs>;
pub type W = crate::W<CFGR2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OVSE {
Disabled = 0,
Enabled = 1,
}
impl From<OVSE> for bool {
#[inline(always)]
fn from(variant: OVSE) -> Self {
variant as u8 != 0
}
}
pub type OVSE_R = crate::BitReader<OVSE>;
impl OVSE_R {
#[inline(always)]
pub const fn variant(&self) -> OVSE {
match self.bits {
false => OVSE::Disabled,
true => OVSE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == OVSE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == OVSE::Enabled
}
}
pub type OVSE_W<'a, REG> = crate::BitWriter<'a, REG, OVSE>;
impl<'a, REG> OVSE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(OVSE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(OVSE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum OVSR {
Mul2 = 0,
Mul4 = 1,
Mul8 = 2,
Mul16 = 3,
Mul32 = 4,
Mul64 = 5,
Mul128 = 6,
Mul256 = 7,
}
impl From<OVSR> for u8 {
#[inline(always)]
fn from(variant: OVSR) -> Self {
variant as _
}
}
impl crate::FieldSpec for OVSR {
type Ux = u8;
}
impl crate::IsEnum for OVSR {}
pub type OVSR_R = crate::FieldReader<OVSR>;
impl OVSR_R {
#[inline(always)]
pub const fn variant(&self) -> OVSR {
match self.bits {
0 => OVSR::Mul2,
1 => OVSR::Mul4,
2 => OVSR::Mul8,
3 => OVSR::Mul16,
4 => OVSR::Mul32,
5 => OVSR::Mul64,
6 => OVSR::Mul128,
7 => OVSR::Mul256,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_mul2(&self) -> bool {
*self == OVSR::Mul2
}
#[inline(always)]
pub fn is_mul4(&self) -> bool {
*self == OVSR::Mul4
}
#[inline(always)]
pub fn is_mul8(&self) -> bool {
*self == OVSR::Mul8
}
#[inline(always)]
pub fn is_mul16(&self) -> bool {
*self == OVSR::Mul16
}
#[inline(always)]
pub fn is_mul32(&self) -> bool {
*self == OVSR::Mul32
}
#[inline(always)]
pub fn is_mul64(&self) -> bool {
*self == OVSR::Mul64
}
#[inline(always)]
pub fn is_mul128(&self) -> bool {
*self == OVSR::Mul128
}
#[inline(always)]
pub fn is_mul256(&self) -> bool {
*self == OVSR::Mul256
}
}
pub type OVSR_W<'a, REG> = crate::FieldWriter<'a, REG, 3, OVSR, crate::Safe>;
impl<'a, REG> OVSR_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn mul2(self) -> &'a mut crate::W<REG> {
self.variant(OVSR::Mul2)
}
#[inline(always)]
pub fn mul4(self) -> &'a mut crate::W<REG> {
self.variant(OVSR::Mul4)
}
#[inline(always)]
pub fn mul8(self) -> &'a mut crate::W<REG> {
self.variant(OVSR::Mul8)
}
#[inline(always)]
pub fn mul16(self) -> &'a mut crate::W<REG> {
self.variant(OVSR::Mul16)
}
#[inline(always)]
pub fn mul32(self) -> &'a mut crate::W<REG> {
self.variant(OVSR::Mul32)
}
#[inline(always)]
pub fn mul64(self) -> &'a mut crate::W<REG> {
self.variant(OVSR::Mul64)
}
#[inline(always)]
pub fn mul128(self) -> &'a mut crate::W<REG> {
self.variant(OVSR::Mul128)
}
#[inline(always)]
pub fn mul256(self) -> &'a mut crate::W<REG> {
self.variant(OVSR::Mul256)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum OVSS {
NoShift = 0,
Shift1 = 1,
Shift2 = 2,
Shift3 = 3,
Shift4 = 4,
Shift5 = 5,
Shift6 = 6,
Shift7 = 7,
Shift8 = 8,
}
impl From<OVSS> for u8 {
#[inline(always)]
fn from(variant: OVSS) -> Self {
variant as _
}
}
impl crate::FieldSpec for OVSS {
type Ux = u8;
}
impl crate::IsEnum for OVSS {}
pub type OVSS_R = crate::FieldReader<OVSS>;
impl OVSS_R {
#[inline(always)]
pub const fn variant(&self) -> Option<OVSS> {
match self.bits {
0 => Some(OVSS::NoShift),
1 => Some(OVSS::Shift1),
2 => Some(OVSS::Shift2),
3 => Some(OVSS::Shift3),
4 => Some(OVSS::Shift4),
5 => Some(OVSS::Shift5),
6 => Some(OVSS::Shift6),
7 => Some(OVSS::Shift7),
8 => Some(OVSS::Shift8),
_ => None,
}
}
#[inline(always)]
pub fn is_no_shift(&self) -> bool {
*self == OVSS::NoShift
}
#[inline(always)]
pub fn is_shift1(&self) -> bool {
*self == OVSS::Shift1
}
#[inline(always)]
pub fn is_shift2(&self) -> bool {
*self == OVSS::Shift2
}
#[inline(always)]
pub fn is_shift3(&self) -> bool {
*self == OVSS::Shift3
}
#[inline(always)]
pub fn is_shift4(&self) -> bool {
*self == OVSS::Shift4
}
#[inline(always)]
pub fn is_shift5(&self) -> bool {
*self == OVSS::Shift5
}
#[inline(always)]
pub fn is_shift6(&self) -> bool {
*self == OVSS::Shift6
}
#[inline(always)]
pub fn is_shift7(&self) -> bool {
*self == OVSS::Shift7
}
#[inline(always)]
pub fn is_shift8(&self) -> bool {
*self == OVSS::Shift8
}
}
pub type OVSS_W<'a, REG> = crate::FieldWriter<'a, REG, 4, OVSS>;
impl<'a, REG> OVSS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn no_shift(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::NoShift)
}
#[inline(always)]
pub fn shift1(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::Shift1)
}
#[inline(always)]
pub fn shift2(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::Shift2)
}
#[inline(always)]
pub fn shift3(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::Shift3)
}
#[inline(always)]
pub fn shift4(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::Shift4)
}
#[inline(always)]
pub fn shift5(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::Shift5)
}
#[inline(always)]
pub fn shift6(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::Shift6)
}
#[inline(always)]
pub fn shift7(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::Shift7)
}
#[inline(always)]
pub fn shift8(self) -> &'a mut crate::W<REG> {
self.variant(OVSS::Shift8)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TOVS {
TriggerAll = 0,
TriggerEach = 1,
}
impl From<TOVS> for bool {
#[inline(always)]
fn from(variant: TOVS) -> Self {
variant as u8 != 0
}
}
pub type TOVS_R = crate::BitReader<TOVS>;
impl TOVS_R {
#[inline(always)]
pub const fn variant(&self) -> TOVS {
match self.bits {
false => TOVS::TriggerAll,
true => TOVS::TriggerEach,
}
}
#[inline(always)]
pub fn is_trigger_all(&self) -> bool {
*self == TOVS::TriggerAll
}
#[inline(always)]
pub fn is_trigger_each(&self) -> bool {
*self == TOVS::TriggerEach
}
}
pub type TOVS_W<'a, REG> = crate::BitWriter<'a, REG, TOVS>;
impl<'a, REG> TOVS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn trigger_all(self) -> &'a mut crate::W<REG> {
self.variant(TOVS::TriggerAll)
}
#[inline(always)]
pub fn trigger_each(self) -> &'a mut crate::W<REG> {
self.variant(TOVS::TriggerEach)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LFTRIG {
Disabled = 0,
Enabled = 1,
}
impl From<LFTRIG> for bool {
#[inline(always)]
fn from(variant: LFTRIG) -> Self {
variant as u8 != 0
}
}
pub type LFTRIG_R = crate::BitReader<LFTRIG>;
impl LFTRIG_R {
#[inline(always)]
pub const fn variant(&self) -> LFTRIG {
match self.bits {
false => LFTRIG::Disabled,
true => LFTRIG::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == LFTRIG::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == LFTRIG::Enabled
}
}
pub type LFTRIG_W<'a, REG> = crate::BitWriter<'a, REG, LFTRIG>;
impl<'a, REG> LFTRIG_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(LFTRIG::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(LFTRIG::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CKMODE {
Adclk = 0,
PclkDiv2 = 1,
PclkDiv4 = 2,
Pclk = 3,
}
impl From<CKMODE> for u8 {
#[inline(always)]
fn from(variant: CKMODE) -> Self {
variant as _
}
}
impl crate::FieldSpec for CKMODE {
type Ux = u8;
}
impl crate::IsEnum for CKMODE {}
pub type CKMODE_R = crate::FieldReader<CKMODE>;
impl CKMODE_R {
#[inline(always)]
pub const fn variant(&self) -> CKMODE {
match self.bits {
0 => CKMODE::Adclk,
1 => CKMODE::PclkDiv2,
2 => CKMODE::PclkDiv4,
3 => CKMODE::Pclk,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_adclk(&self) -> bool {
*self == CKMODE::Adclk
}
#[inline(always)]
pub fn is_pclk_div2(&self) -> bool {
*self == CKMODE::PclkDiv2
}
#[inline(always)]
pub fn is_pclk_div4(&self) -> bool {
*self == CKMODE::PclkDiv4
}
#[inline(always)]
pub fn is_pclk(&self) -> bool {
*self == CKMODE::Pclk
}
}
pub type CKMODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CKMODE, crate::Safe>;
impl<'a, REG> CKMODE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn adclk(self) -> &'a mut crate::W<REG> {
self.variant(CKMODE::Adclk)
}
#[inline(always)]
pub fn pclk_div2(self) -> &'a mut crate::W<REG> {
self.variant(CKMODE::PclkDiv2)
}
#[inline(always)]
pub fn pclk_div4(self) -> &'a mut crate::W<REG> {
self.variant(CKMODE::PclkDiv4)
}
#[inline(always)]
pub fn pclk(self) -> &'a mut crate::W<REG> {
self.variant(CKMODE::Pclk)
}
}
impl R {
#[inline(always)]
pub fn ovse(&self) -> OVSE_R {
OVSE_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn ovsr(&self) -> OVSR_R {
OVSR_R::new(((self.bits >> 2) & 7) as u8)
}
#[inline(always)]
pub fn ovss(&self) -> OVSS_R {
OVSS_R::new(((self.bits >> 5) & 0x0f) as u8)
}
#[inline(always)]
pub fn tovs(&self) -> TOVS_R {
TOVS_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn lftrig(&self) -> LFTRIG_R {
LFTRIG_R::new(((self.bits >> 29) & 1) != 0)
}
#[inline(always)]
pub fn ckmode(&self) -> CKMODE_R {
CKMODE_R::new(((self.bits >> 30) & 3) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CFGR2")
.field("ovse", &self.ovse())
.field("ovsr", &self.ovsr())
.field("ovss", &self.ovss())
.field("tovs", &self.tovs())
.field("lftrig", &self.lftrig())
.field("ckmode", &self.ckmode())
.finish()
}
}
impl W {
#[inline(always)]
pub fn ovse(&mut self) -> OVSE_W<CFGR2rs> {
OVSE_W::new(self, 0)
}
#[inline(always)]
pub fn ovsr(&mut self) -> OVSR_W<CFGR2rs> {
OVSR_W::new(self, 2)
}
#[inline(always)]
pub fn ovss(&mut self) -> OVSS_W<CFGR2rs> {
OVSS_W::new(self, 5)
}
#[inline(always)]
pub fn tovs(&mut self) -> TOVS_W<CFGR2rs> {
TOVS_W::new(self, 9)
}
#[inline(always)]
pub fn lftrig(&mut self) -> LFTRIG_W<CFGR2rs> {
LFTRIG_W::new(self, 29)
}
#[inline(always)]
pub fn ckmode(&mut self) -> CKMODE_W<CFGR2rs> {
CKMODE_W::new(self, 30)
}
}
pub struct CFGR2rs;
impl crate::RegisterSpec for CFGR2rs {
type Ux = u32;
}
impl crate::Readable for CFGR2rs {}
impl crate::Writable for CFGR2rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CFGR2rs {}