pub type R = crate::R<CFGR3rs>;
pub type W = crate::W<CFGR3rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EN_VREFINT {
Disabled = 0,
Enabled = 1,
}
impl From<EN_VREFINT> for bool {
#[inline(always)]
fn from(variant: EN_VREFINT) -> Self {
variant as u8 != 0
}
}
pub type EN_VREFINT_R = crate::BitReader<EN_VREFINT>;
impl EN_VREFINT_R {
#[inline(always)]
pub const fn variant(&self) -> EN_VREFINT {
match self.bits {
false => EN_VREFINT::Disabled,
true => EN_VREFINT::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EN_VREFINT::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EN_VREFINT::Enabled
}
}
pub type EN_VREFINT_W<'a, REG> = crate::BitWriter<'a, REG, EN_VREFINT>;
impl<'a, REG> EN_VREFINT_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(EN_VREFINT::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(EN_VREFINT::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum SEL_VREF_OUT {
NoConnection = 0,
Pb0 = 1,
Pb1 = 2,
Both = 3,
}
impl From<SEL_VREF_OUT> for u8 {
#[inline(always)]
fn from(variant: SEL_VREF_OUT) -> Self {
variant as _
}
}
impl crate::FieldSpec for SEL_VREF_OUT {
type Ux = u8;
}
impl crate::IsEnum for SEL_VREF_OUT {}
pub type SEL_VREF_OUT_R = crate::FieldReader<SEL_VREF_OUT>;
impl SEL_VREF_OUT_R {
#[inline(always)]
pub const fn variant(&self) -> SEL_VREF_OUT {
match self.bits {
0 => SEL_VREF_OUT::NoConnection,
1 => SEL_VREF_OUT::Pb0,
2 => SEL_VREF_OUT::Pb1,
3 => SEL_VREF_OUT::Both,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_no_connection(&self) -> bool {
*self == SEL_VREF_OUT::NoConnection
}
#[inline(always)]
pub fn is_pb0(&self) -> bool {
*self == SEL_VREF_OUT::Pb0
}
#[inline(always)]
pub fn is_pb1(&self) -> bool {
*self == SEL_VREF_OUT::Pb1
}
#[inline(always)]
pub fn is_both(&self) -> bool {
*self == SEL_VREF_OUT::Both
}
}
pub type SEL_VREF_OUT_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SEL_VREF_OUT, crate::Safe>;
impl<'a, REG> SEL_VREF_OUT_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn no_connection(self) -> &'a mut crate::W<REG> {
self.variant(SEL_VREF_OUT::NoConnection)
}
#[inline(always)]
pub fn pb0(self) -> &'a mut crate::W<REG> {
self.variant(SEL_VREF_OUT::Pb0)
}
#[inline(always)]
pub fn pb1(self) -> &'a mut crate::W<REG> {
self.variant(SEL_VREF_OUT::Pb1)
}
#[inline(always)]
pub fn both(self) -> &'a mut crate::W<REG> {
self.variant(SEL_VREF_OUT::Both)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENBUF_VREFINT_ADC {
Disabled = 0,
Enabled = 1,
}
impl From<ENBUF_VREFINT_ADC> for bool {
#[inline(always)]
fn from(variant: ENBUF_VREFINT_ADC) -> Self {
variant as u8 != 0
}
}
pub type ENBUF_VREFINT_ADC_R = crate::BitReader<ENBUF_VREFINT_ADC>;
impl ENBUF_VREFINT_ADC_R {
#[inline(always)]
pub const fn variant(&self) -> ENBUF_VREFINT_ADC {
match self.bits {
false => ENBUF_VREFINT_ADC::Disabled,
true => ENBUF_VREFINT_ADC::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ENBUF_VREFINT_ADC::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ENBUF_VREFINT_ADC::Enabled
}
}
pub type ENBUF_VREFINT_ADC_W<'a, REG> = crate::BitWriter<'a, REG, ENBUF_VREFINT_ADC>;
impl<'a, REG> ENBUF_VREFINT_ADC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ENBUF_VREFINT_ADC::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ENBUF_VREFINT_ADC::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENBUF_SENSOR_ADC {
Disabled = 0,
Enabled = 1,
}
impl From<ENBUF_SENSOR_ADC> for bool {
#[inline(always)]
fn from(variant: ENBUF_SENSOR_ADC) -> Self {
variant as u8 != 0
}
}
pub type ENBUF_SENSOR_ADC_R = crate::BitReader<ENBUF_SENSOR_ADC>;
impl ENBUF_SENSOR_ADC_R {
#[inline(always)]
pub const fn variant(&self) -> ENBUF_SENSOR_ADC {
match self.bits {
false => ENBUF_SENSOR_ADC::Disabled,
true => ENBUF_SENSOR_ADC::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ENBUF_SENSOR_ADC::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ENBUF_SENSOR_ADC::Enabled
}
}
pub type ENBUF_SENSOR_ADC_W<'a, REG> = crate::BitWriter<'a, REG, ENBUF_SENSOR_ADC>;
impl<'a, REG> ENBUF_SENSOR_ADC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ENBUF_SENSOR_ADC::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ENBUF_SENSOR_ADC::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ENBUF_VREFINT_COMP2 {
Disabled = 0,
Enabled = 1,
}
impl From<ENBUF_VREFINT_COMP2> for bool {
#[inline(always)]
fn from(variant: ENBUF_VREFINT_COMP2) -> Self {
variant as u8 != 0
}
}
pub type ENBUF_VREFINT_COMP2_R = crate::BitReader<ENBUF_VREFINT_COMP2>;
impl ENBUF_VREFINT_COMP2_R {
#[inline(always)]
pub const fn variant(&self) -> ENBUF_VREFINT_COMP2 {
match self.bits {
false => ENBUF_VREFINT_COMP2::Disabled,
true => ENBUF_VREFINT_COMP2::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ENBUF_VREFINT_COMP2::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == ENBUF_VREFINT_COMP2::Enabled
}
}
pub type ENBUF_VREFINT_COMP2_W<'a, REG> = crate::BitWriter<'a, REG, ENBUF_VREFINT_COMP2>;
impl<'a, REG> ENBUF_VREFINT_COMP2_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ENBUF_VREFINT_COMP2::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(ENBUF_VREFINT_COMP2::Enabled)
}
}
pub type ENREF_HSI48_R = crate::BitReader;
pub type ENREF_HSI48_W<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VREFINT_RDYF {
NotReady = 0,
Ready = 1,
}
impl From<VREFINT_RDYF> for bool {
#[inline(always)]
fn from(variant: VREFINT_RDYF) -> Self {
variant as u8 != 0
}
}
pub type VREFINT_RDYF_R = crate::BitReader<VREFINT_RDYF>;
impl VREFINT_RDYF_R {
#[inline(always)]
pub const fn variant(&self) -> VREFINT_RDYF {
match self.bits {
false => VREFINT_RDYF::NotReady,
true => VREFINT_RDYF::Ready,
}
}
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == VREFINT_RDYF::NotReady
}
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == VREFINT_RDYF::Ready
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum REF_LOCK {
ReadWrite = 0,
ReadOnly = 1,
}
impl From<REF_LOCK> for bool {
#[inline(always)]
fn from(variant: REF_LOCK) -> Self {
variant as u8 != 0
}
}
pub type REF_LOCK_R = crate::BitReader<REF_LOCK>;
impl REF_LOCK_R {
#[inline(always)]
pub const fn variant(&self) -> REF_LOCK {
match self.bits {
false => REF_LOCK::ReadWrite,
true => REF_LOCK::ReadOnly,
}
}
#[inline(always)]
pub fn is_read_write(&self) -> bool {
*self == REF_LOCK::ReadWrite
}
#[inline(always)]
pub fn is_read_only(&self) -> bool {
*self == REF_LOCK::ReadOnly
}
}
pub type REF_LOCK_W<'a, REG> = crate::BitWriter<'a, REG, REF_LOCK>;
impl<'a, REG> REF_LOCK_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn read_write(self) -> &'a mut crate::W<REG> {
self.variant(REF_LOCK::ReadWrite)
}
#[inline(always)]
pub fn read_only(self) -> &'a mut crate::W<REG> {
self.variant(REF_LOCK::ReadOnly)
}
}
impl R {
#[inline(always)]
pub fn en_vrefint(&self) -> EN_VREFINT_R {
EN_VREFINT_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn sel_vref_out(&self) -> SEL_VREF_OUT_R {
SEL_VREF_OUT_R::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn enbuf_vrefint_adc(&self) -> ENBUF_VREFINT_ADC_R {
ENBUF_VREFINT_ADC_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn enbuf_sensor_adc(&self) -> ENBUF_SENSOR_ADC_R {
ENBUF_SENSOR_ADC_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn enbuf_vrefint_comp2(&self) -> ENBUF_VREFINT_COMP2_R {
ENBUF_VREFINT_COMP2_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn enref_hsi48(&self) -> ENREF_HSI48_R {
ENREF_HSI48_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn vrefint_rdyf(&self) -> VREFINT_RDYF_R {
VREFINT_RDYF_R::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn ref_lock(&self) -> REF_LOCK_R {
REF_LOCK_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("CFGR3")
.field("vrefint_rdyf", &self.vrefint_rdyf())
.field("enbuf_sensor_adc", &self.enbuf_sensor_adc())
.field("sel_vref_out", &self.sel_vref_out())
.field("enref_hsi48", &self.enref_hsi48())
.field("ref_lock", &self.ref_lock())
.field("enbuf_vrefint_comp2", &self.enbuf_vrefint_comp2())
.field("enbuf_vrefint_adc", &self.enbuf_vrefint_adc())
.field("en_vrefint", &self.en_vrefint())
.finish()
}
}
impl W {
#[inline(always)]
pub fn en_vrefint(&mut self) -> EN_VREFINT_W<CFGR3rs> {
EN_VREFINT_W::new(self, 0)
}
#[inline(always)]
pub fn sel_vref_out(&mut self) -> SEL_VREF_OUT_W<CFGR3rs> {
SEL_VREF_OUT_W::new(self, 4)
}
#[inline(always)]
pub fn enbuf_vrefint_adc(&mut self) -> ENBUF_VREFINT_ADC_W<CFGR3rs> {
ENBUF_VREFINT_ADC_W::new(self, 8)
}
#[inline(always)]
pub fn enbuf_sensor_adc(&mut self) -> ENBUF_SENSOR_ADC_W<CFGR3rs> {
ENBUF_SENSOR_ADC_W::new(self, 9)
}
#[inline(always)]
pub fn enbuf_vrefint_comp2(&mut self) -> ENBUF_VREFINT_COMP2_W<CFGR3rs> {
ENBUF_VREFINT_COMP2_W::new(self, 12)
}
#[inline(always)]
pub fn enref_hsi48(&mut self) -> ENREF_HSI48_W<CFGR3rs> {
ENREF_HSI48_W::new(self, 13)
}
#[inline(always)]
pub fn ref_lock(&mut self) -> REF_LOCK_W<CFGR3rs> {
REF_LOCK_W::new(self, 31)
}
}
pub struct CFGR3rs;
impl crate::RegisterSpec for CFGR3rs {
type Ux = u32;
}
impl crate::Readable for CFGR3rs {}
impl crate::Writable for CFGR3rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CFGR3rs {}