pub type R = crate::R<BCDRrs>;
pub type W = crate::W<BCDRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BCDEN {
Disabled = 0,
Enabled = 1,
}
impl From<BCDEN> for bool {
#[inline(always)]
fn from(variant: BCDEN) -> Self {
variant as u8 != 0
}
}
pub type BCDEN_R = crate::BitReader<BCDEN>;
impl BCDEN_R {
#[inline(always)]
pub const fn variant(&self) -> BCDEN {
match self.bits {
false => BCDEN::Disabled,
true => BCDEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == BCDEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == BCDEN::Enabled
}
}
pub type BCDEN_W<'a, REG> = crate::BitWriter<'a, REG, BCDEN>;
impl<'a, REG> BCDEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(BCDEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(BCDEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DCDEN {
Disabled = 0,
Enabled = 1,
}
impl From<DCDEN> for bool {
#[inline(always)]
fn from(variant: DCDEN) -> Self {
variant as u8 != 0
}
}
pub type DCDEN_R = crate::BitReader<DCDEN>;
impl DCDEN_R {
#[inline(always)]
pub const fn variant(&self) -> DCDEN {
match self.bits {
false => DCDEN::Disabled,
true => DCDEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DCDEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DCDEN::Enabled
}
}
pub type DCDEN_W<'a, REG> = crate::BitWriter<'a, REG, DCDEN>;
impl<'a, REG> DCDEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DCDEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DCDEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PDEN {
Disabled = 0,
Enabled = 1,
}
impl From<PDEN> for bool {
#[inline(always)]
fn from(variant: PDEN) -> Self {
variant as u8 != 0
}
}
pub type PDEN_R = crate::BitReader<PDEN>;
impl PDEN_R {
#[inline(always)]
pub const fn variant(&self) -> PDEN {
match self.bits {
false => PDEN::Disabled,
true => PDEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PDEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PDEN::Enabled
}
}
pub type PDEN_W<'a, REG> = crate::BitWriter<'a, REG, PDEN>;
impl<'a, REG> PDEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(PDEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(PDEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SDEN {
Disabled = 0,
Enabled = 1,
}
impl From<SDEN> for bool {
#[inline(always)]
fn from(variant: SDEN) -> Self {
variant as u8 != 0
}
}
pub type SDEN_R = crate::BitReader<SDEN>;
impl SDEN_R {
#[inline(always)]
pub const fn variant(&self) -> SDEN {
match self.bits {
false => SDEN::Disabled,
true => SDEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == SDEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == SDEN::Enabled
}
}
pub type SDEN_W<'a, REG> = crate::BitWriter<'a, REG, SDEN>;
impl<'a, REG> SDEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(SDEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(SDEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DCDET {
NotDetected = 0,
Detected = 1,
}
impl From<DCDET> for bool {
#[inline(always)]
fn from(variant: DCDET) -> Self {
variant as u8 != 0
}
}
pub type DCDET_R = crate::BitReader<DCDET>;
impl DCDET_R {
#[inline(always)]
pub const fn variant(&self) -> DCDET {
match self.bits {
false => DCDET::NotDetected,
true => DCDET::Detected,
}
}
#[inline(always)]
pub fn is_not_detected(&self) -> bool {
*self == DCDET::NotDetected
}
#[inline(always)]
pub fn is_detected(&self) -> bool {
*self == DCDET::Detected
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PDET {
NoBcd = 0,
Bcd = 1,
}
impl From<PDET> for bool {
#[inline(always)]
fn from(variant: PDET) -> Self {
variant as u8 != 0
}
}
pub type PDET_R = crate::BitReader<PDET>;
impl PDET_R {
#[inline(always)]
pub const fn variant(&self) -> PDET {
match self.bits {
false => PDET::NoBcd,
true => PDET::Bcd,
}
}
#[inline(always)]
pub fn is_no_bcd(&self) -> bool {
*self == PDET::NoBcd
}
#[inline(always)]
pub fn is_bcd(&self) -> bool {
*self == PDET::Bcd
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SDET {
Cdp = 0,
Dcp = 1,
}
impl From<SDET> for bool {
#[inline(always)]
fn from(variant: SDET) -> Self {
variant as u8 != 0
}
}
pub type SDET_R = crate::BitReader<SDET>;
impl SDET_R {
#[inline(always)]
pub const fn variant(&self) -> SDET {
match self.bits {
false => SDET::Cdp,
true => SDET::Dcp,
}
}
#[inline(always)]
pub fn is_cdp(&self) -> bool {
*self == SDET::Cdp
}
#[inline(always)]
pub fn is_dcp(&self) -> bool {
*self == SDET::Dcp
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PS2DET {
Normal = 0,
Ps2 = 1,
}
impl From<PS2DET> for bool {
#[inline(always)]
fn from(variant: PS2DET) -> Self {
variant as u8 != 0
}
}
pub type PS2DET_R = crate::BitReader<PS2DET>;
impl PS2DET_R {
#[inline(always)]
pub const fn variant(&self) -> PS2DET {
match self.bits {
false => PS2DET::Normal,
true => PS2DET::Ps2,
}
}
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == PS2DET::Normal
}
#[inline(always)]
pub fn is_ps2(&self) -> bool {
*self == PS2DET::Ps2
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DPPU {
Disabled = 0,
Enabled = 1,
}
impl From<DPPU> for bool {
#[inline(always)]
fn from(variant: DPPU) -> Self {
variant as u8 != 0
}
}
pub type DPPU_R = crate::BitReader<DPPU>;
impl DPPU_R {
#[inline(always)]
pub const fn variant(&self) -> DPPU {
match self.bits {
false => DPPU::Disabled,
true => DPPU::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DPPU::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DPPU::Enabled
}
}
pub type DPPU_W<'a, REG> = crate::BitWriter<'a, REG, DPPU>;
impl<'a, REG> DPPU_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DPPU::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DPPU::Enabled)
}
}
impl R {
#[inline(always)]
pub fn bcden(&self) -> BCDEN_R {
BCDEN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn dcden(&self) -> DCDEN_R {
DCDEN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn pden(&self) -> PDEN_R {
PDEN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn sden(&self) -> SDEN_R {
SDEN_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn dcdet(&self) -> DCDET_R {
DCDET_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn pdet(&self) -> PDET_R {
PDET_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn sdet(&self) -> SDET_R {
SDET_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn ps2det(&self) -> PS2DET_R {
PS2DET_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn dppu(&self) -> DPPU_R {
DPPU_R::new(((self.bits >> 15) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("BCDR")
.field("bcden", &self.bcden())
.field("dcden", &self.dcden())
.field("pden", &self.pden())
.field("sden", &self.sden())
.field("dcdet", &self.dcdet())
.field("pdet", &self.pdet())
.field("sdet", &self.sdet())
.field("ps2det", &self.ps2det())
.field("dppu", &self.dppu())
.finish()
}
}
impl W {
#[inline(always)]
pub fn bcden(&mut self) -> BCDEN_W<BCDRrs> {
BCDEN_W::new(self, 0)
}
#[inline(always)]
pub fn dcden(&mut self) -> DCDEN_W<BCDRrs> {
DCDEN_W::new(self, 1)
}
#[inline(always)]
pub fn pden(&mut self) -> PDEN_W<BCDRrs> {
PDEN_W::new(self, 2)
}
#[inline(always)]
pub fn sden(&mut self) -> SDEN_W<BCDRrs> {
SDEN_W::new(self, 3)
}
#[inline(always)]
pub fn dppu(&mut self) -> DPPU_W<BCDRrs> {
DPPU_W::new(self, 15)
}
}
pub struct BCDRrs;
impl crate::RegisterSpec for BCDRrs {
type Ux = u16;
}
impl crate::Readable for BCDRrs {}
impl crate::Writable for BCDRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for BCDRrs {}