pub type R = crate::R<CTRLrs>;
pub type W = crate::W<CTRLrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum WARMUPMODE {
Normal = 0,
Keepinstandby = 1,
Keepinslowacc = 2,
Keepadcwarm = 3,
}
impl From<WARMUPMODE> for u8 {
#[inline(always)]
fn from(variant: WARMUPMODE) -> Self {
variant as _
}
}
impl crate::FieldSpec for WARMUPMODE {
type Ux = u8;
}
impl crate::IsEnum for WARMUPMODE {}
pub type WarmupmodeR = crate::FieldReader<WARMUPMODE>;
impl WarmupmodeR {
#[inline(always)]
pub const fn variant(&self) -> WARMUPMODE {
match self.bits {
0 => WARMUPMODE::Normal,
1 => WARMUPMODE::Keepinstandby,
2 => WARMUPMODE::Keepinslowacc,
3 => WARMUPMODE::Keepadcwarm,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == WARMUPMODE::Normal
}
#[inline(always)]
pub fn is_keepinstandby(&self) -> bool {
*self == WARMUPMODE::Keepinstandby
}
#[inline(always)]
pub fn is_keepinslowacc(&self) -> bool {
*self == WARMUPMODE::Keepinslowacc
}
#[inline(always)]
pub fn is_keepadcwarm(&self) -> bool {
*self == WARMUPMODE::Keepadcwarm
}
}
pub type WarmupmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2, WARMUPMODE, crate::Safe>;
impl<'a, REG> WarmupmodeW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn normal(self) -> &'a mut crate::W<REG> {
self.variant(WARMUPMODE::Normal)
}
#[inline(always)]
pub fn keepinstandby(self) -> &'a mut crate::W<REG> {
self.variant(WARMUPMODE::Keepinstandby)
}
#[inline(always)]
pub fn keepinslowacc(self) -> &'a mut crate::W<REG> {
self.variant(WARMUPMODE::Keepinslowacc)
}
#[inline(always)]
pub fn keepadcwarm(self) -> &'a mut crate::W<REG> {
self.variant(WARMUPMODE::Keepadcwarm)
}
}
pub type SingledmawuR = crate::BitReader;
pub type SingledmawuW<'a, REG> = crate::BitWriter<'a, REG>;
pub type ScandmawuR = crate::BitReader;
pub type ScandmawuW<'a, REG> = crate::BitWriter<'a, REG>;
pub type TailgateR = crate::BitReader;
pub type TailgateW<'a, REG> = crate::BitWriter<'a, REG>;
pub type AsyncclkenR = crate::BitReader;
pub type AsyncclkenW<'a, REG> = crate::BitWriter<'a, REG>;
pub type AdcclkmodeR = crate::BitReader;
pub type AdcclkmodeW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PRESC {
Nodivision = 0,
}
impl From<PRESC> for u8 {
#[inline(always)]
fn from(variant: PRESC) -> Self {
variant as _
}
}
impl crate::FieldSpec for PRESC {
type Ux = u8;
}
impl crate::IsEnum for PRESC {}
pub type PrescR = crate::FieldReader<PRESC>;
impl PrescR {
#[inline(always)]
pub const fn variant(&self) -> Option<PRESC> {
match self.bits {
0 => Some(PRESC::Nodivision),
_ => None,
}
}
#[inline(always)]
pub fn is_nodivision(&self) -> bool {
*self == PRESC::Nodivision
}
}
pub type PrescW<'a, REG> = crate::FieldWriter<'a, REG, 7, PRESC>;
impl<'a, REG> PrescW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn nodivision(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Nodivision)
}
}
pub type TimebaseR = crate::FieldReader;
pub type TimebaseW<'a, REG> = crate::FieldWriter<'a, REG, 7>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum OVSRSEL {
X2 = 0,
X4 = 1,
X8 = 2,
X16 = 3,
X32 = 4,
X64 = 5,
X128 = 6,
X256 = 7,
X512 = 8,
X1024 = 9,
X2048 = 10,
X4096 = 11,
}
impl From<OVSRSEL> for u8 {
#[inline(always)]
fn from(variant: OVSRSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for OVSRSEL {
type Ux = u8;
}
impl crate::IsEnum for OVSRSEL {}
pub type OvsrselR = crate::FieldReader<OVSRSEL>;
impl OvsrselR {
#[inline(always)]
pub const fn variant(&self) -> Option<OVSRSEL> {
match self.bits {
0 => Some(OVSRSEL::X2),
1 => Some(OVSRSEL::X4),
2 => Some(OVSRSEL::X8),
3 => Some(OVSRSEL::X16),
4 => Some(OVSRSEL::X32),
5 => Some(OVSRSEL::X64),
6 => Some(OVSRSEL::X128),
7 => Some(OVSRSEL::X256),
8 => Some(OVSRSEL::X512),
9 => Some(OVSRSEL::X1024),
10 => Some(OVSRSEL::X2048),
11 => Some(OVSRSEL::X4096),
_ => None,
}
}
#[inline(always)]
pub fn is_x2(&self) -> bool {
*self == OVSRSEL::X2
}
#[inline(always)]
pub fn is_x4(&self) -> bool {
*self == OVSRSEL::X4
}
#[inline(always)]
pub fn is_x8(&self) -> bool {
*self == OVSRSEL::X8
}
#[inline(always)]
pub fn is_x16(&self) -> bool {
*self == OVSRSEL::X16
}
#[inline(always)]
pub fn is_x32(&self) -> bool {
*self == OVSRSEL::X32
}
#[inline(always)]
pub fn is_x64(&self) -> bool {
*self == OVSRSEL::X64
}
#[inline(always)]
pub fn is_x128(&self) -> bool {
*self == OVSRSEL::X128
}
#[inline(always)]
pub fn is_x256(&self) -> bool {
*self == OVSRSEL::X256
}
#[inline(always)]
pub fn is_x512(&self) -> bool {
*self == OVSRSEL::X512
}
#[inline(always)]
pub fn is_x1024(&self) -> bool {
*self == OVSRSEL::X1024
}
#[inline(always)]
pub fn is_x2048(&self) -> bool {
*self == OVSRSEL::X2048
}
#[inline(always)]
pub fn is_x4096(&self) -> bool {
*self == OVSRSEL::X4096
}
}
pub type OvsrselW<'a, REG> = crate::FieldWriter<'a, REG, 4, OVSRSEL>;
impl<'a, REG> OvsrselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn x2(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X2)
}
#[inline(always)]
pub fn x4(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X4)
}
#[inline(always)]
pub fn x8(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X8)
}
#[inline(always)]
pub fn x16(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X16)
}
#[inline(always)]
pub fn x32(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X32)
}
#[inline(always)]
pub fn x64(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X64)
}
#[inline(always)]
pub fn x128(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X128)
}
#[inline(always)]
pub fn x256(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X256)
}
#[inline(always)]
pub fn x512(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X512)
}
#[inline(always)]
pub fn x1024(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X1024)
}
#[inline(always)]
pub fn x2048(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X2048)
}
#[inline(always)]
pub fn x4096(self) -> &'a mut crate::W<REG> {
self.variant(OVSRSEL::X4096)
}
}
pub type ChconmodeR = crate::BitReader;
pub type ChconmodeW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn warmupmode(&self) -> WarmupmodeR {
WarmupmodeR::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn singledmawu(&self) -> SingledmawuR {
SingledmawuR::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn scandmawu(&self) -> ScandmawuR {
ScandmawuR::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn tailgate(&self) -> TailgateR {
TailgateR::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn asyncclken(&self) -> AsyncclkenR {
AsyncclkenR::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn adcclkmode(&self) -> AdcclkmodeR {
AdcclkmodeR::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn presc(&self) -> PrescR {
PrescR::new(((self.bits >> 8) & 0x7f) as u8)
}
#[inline(always)]
pub fn timebase(&self) -> TimebaseR {
TimebaseR::new(((self.bits >> 16) & 0x7f) as u8)
}
#[inline(always)]
pub fn ovsrsel(&self) -> OvsrselR {
OvsrselR::new(((self.bits >> 24) & 0x0f) as u8)
}
#[inline(always)]
pub fn chconmode(&self) -> ChconmodeR {
ChconmodeR::new(((self.bits >> 29) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CTRL")
.field("warmupmode", &self.warmupmode())
.field("singledmawu", &self.singledmawu())
.field("scandmawu", &self.scandmawu())
.field("tailgate", &self.tailgate())
.field("asyncclken", &self.asyncclken())
.field("adcclkmode", &self.adcclkmode())
.field("presc", &self.presc())
.field("timebase", &self.timebase())
.field("ovsrsel", &self.ovsrsel())
.field("chconmode", &self.chconmode())
.finish()
}
}
impl W {
#[inline(always)]
pub fn warmupmode(&mut self) -> WarmupmodeW<'_, CTRLrs> {
WarmupmodeW::new(self, 0)
}
#[inline(always)]
pub fn singledmawu(&mut self) -> SingledmawuW<'_, CTRLrs> {
SingledmawuW::new(self, 2)
}
#[inline(always)]
pub fn scandmawu(&mut self) -> ScandmawuW<'_, CTRLrs> {
ScandmawuW::new(self, 3)
}
#[inline(always)]
pub fn tailgate(&mut self) -> TailgateW<'_, CTRLrs> {
TailgateW::new(self, 4)
}
#[inline(always)]
pub fn asyncclken(&mut self) -> AsyncclkenW<'_, CTRLrs> {
AsyncclkenW::new(self, 6)
}
#[inline(always)]
pub fn adcclkmode(&mut self) -> AdcclkmodeW<'_, CTRLrs> {
AdcclkmodeW::new(self, 7)
}
#[inline(always)]
pub fn presc(&mut self) -> PrescW<'_, CTRLrs> {
PrescW::new(self, 8)
}
#[inline(always)]
pub fn timebase(&mut self) -> TimebaseW<'_, CTRLrs> {
TimebaseW::new(self, 16)
}
#[inline(always)]
pub fn ovsrsel(&mut self) -> OvsrselW<'_, CTRLrs> {
OvsrselW::new(self, 24)
}
#[inline(always)]
pub fn chconmode(&mut self) -> ChconmodeW<'_, CTRLrs> {
ChconmodeW::new(self, 29)
}
}
pub struct CTRLrs;
impl crate::RegisterSpec for CTRLrs {
type Ux = u32;
}
impl crate::Readable for CTRLrs {}
impl crate::Writable for CTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CTRLrs {
const RESET_VALUE: u32 = 0x001f_0000;
}