pub type R = crate::R<AF2rs>;
pub type W = crate::W<AF2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BK2INE {
Disabled = 0,
Enabled = 1,
}
impl From<BK2INE> for bool {
#[inline(always)]
fn from(variant: BK2INE) -> Self {
variant as u8 != 0
}
}
pub type BK2INE_R = crate::BitReader<BK2INE>;
impl BK2INE_R {
#[inline(always)]
pub const fn variant(&self) -> BK2INE {
match self.bits {
false => BK2INE::Disabled,
true => BK2INE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == BK2INE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == BK2INE::Enabled
}
}
pub type BK2INE_W<'a, REG> = crate::BitWriter<'a, REG, BK2INE>;
impl<'a, REG> BK2INE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(BK2INE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(BK2INE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BK2CMP1E {
Disabled = 0,
Enabled = 1,
}
impl From<BK2CMP1E> for bool {
#[inline(always)]
fn from(variant: BK2CMP1E) -> Self {
variant as u8 != 0
}
}
pub type BK2CMP1E_R = crate::BitReader<BK2CMP1E>;
impl BK2CMP1E_R {
#[inline(always)]
pub const fn variant(&self) -> BK2CMP1E {
match self.bits {
false => BK2CMP1E::Disabled,
true => BK2CMP1E::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == BK2CMP1E::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == BK2CMP1E::Enabled
}
}
pub type BK2CMP1E_W<'a, REG> = crate::BitWriter<'a, REG, BK2CMP1E>;
impl<'a, REG> BK2CMP1E_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(BK2CMP1E::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(BK2CMP1E::Enabled)
}
}
pub use BK2CMP1E_R as BK2CMP2E_R;
pub use BK2CMP1E_R as BK2CMP3E_R;
pub use BK2CMP1E_R as BK2CMP4E_R;
pub use BK2CMP1E_R as BK2CMP5E_R;
pub use BK2CMP1E_R as BK2CMP6E_R;
pub use BK2CMP1E_R as BK2CMP7E_R;
pub use BK2CMP1E_R as BK2CMP8E_R;
pub use BK2CMP1E_W as BK2CMP2E_W;
pub use BK2CMP1E_W as BK2CMP3E_W;
pub use BK2CMP1E_W as BK2CMP4E_W;
pub use BK2CMP1E_W as BK2CMP5E_W;
pub use BK2CMP1E_W as BK2CMP6E_W;
pub use BK2CMP1E_W as BK2CMP7E_W;
pub use BK2CMP1E_W as BK2CMP8E_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BK2INP {
NotInverted = 0,
Inverted = 1,
}
impl From<BK2INP> for bool {
#[inline(always)]
fn from(variant: BK2INP) -> Self {
variant as u8 != 0
}
}
pub type BK2INP_R = crate::BitReader<BK2INP>;
impl BK2INP_R {
#[inline(always)]
pub const fn variant(&self) -> BK2INP {
match self.bits {
false => BK2INP::NotInverted,
true => BK2INP::Inverted,
}
}
#[inline(always)]
pub fn is_not_inverted(&self) -> bool {
*self == BK2INP::NotInverted
}
#[inline(always)]
pub fn is_inverted(&self) -> bool {
*self == BK2INP::Inverted
}
}
pub type BK2INP_W<'a, REG> = crate::BitWriter<'a, REG, BK2INP>;
impl<'a, REG> BK2INP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_inverted(self) -> &'a mut crate::W<REG> {
self.variant(BK2INP::NotInverted)
}
#[inline(always)]
pub fn inverted(self) -> &'a mut crate::W<REG> {
self.variant(BK2INP::Inverted)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BK2CMP1P {
NotInverted = 0,
Inverted = 1,
}
impl From<BK2CMP1P> for bool {
#[inline(always)]
fn from(variant: BK2CMP1P) -> Self {
variant as u8 != 0
}
}
pub type BK2CMP1P_R = crate::BitReader<BK2CMP1P>;
impl BK2CMP1P_R {
#[inline(always)]
pub const fn variant(&self) -> BK2CMP1P {
match self.bits {
false => BK2CMP1P::NotInverted,
true => BK2CMP1P::Inverted,
}
}
#[inline(always)]
pub fn is_not_inverted(&self) -> bool {
*self == BK2CMP1P::NotInverted
}
#[inline(always)]
pub fn is_inverted(&self) -> bool {
*self == BK2CMP1P::Inverted
}
}
pub type BK2CMP1P_W<'a, REG> = crate::BitWriter<'a, REG, BK2CMP1P>;
impl<'a, REG> BK2CMP1P_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_inverted(self) -> &'a mut crate::W<REG> {
self.variant(BK2CMP1P::NotInverted)
}
#[inline(always)]
pub fn inverted(self) -> &'a mut crate::W<REG> {
self.variant(BK2CMP1P::Inverted)
}
}
pub use BK2CMP1P_R as BK2CMP2P_R;
pub use BK2CMP1P_R as BK2CMP3P_R;
pub use BK2CMP1P_R as BK2CMP4P_R;
pub use BK2CMP1P_W as BK2CMP2P_W;
pub use BK2CMP1P_W as BK2CMP3P_W;
pub use BK2CMP1P_W as BK2CMP4P_W;
pub type OCRSEL_R = crate::FieldReader;
pub type OCRSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3, u8, crate::Safe>;
impl R {
#[inline(always)]
pub fn bk2ine(&self) -> BK2INE_R {
BK2INE_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp1e(&self) -> BK2CMP1E_R {
BK2CMP1E_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp2e(&self) -> BK2CMP2E_R {
BK2CMP2E_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp3e(&self) -> BK2CMP3E_R {
BK2CMP3E_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp4e(&self) -> BK2CMP4E_R {
BK2CMP4E_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp5e(&self) -> BK2CMP5E_R {
BK2CMP5E_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp6e(&self) -> BK2CMP6E_R {
BK2CMP6E_R::new(((self.bits >> 6) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp7e(&self) -> BK2CMP7E_R {
BK2CMP7E_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp8e(&self) -> BK2CMP8E_R {
BK2CMP8E_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn bk2inp(&self) -> BK2INP_R {
BK2INP_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp1p(&self) -> BK2CMP1P_R {
BK2CMP1P_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp2p(&self) -> BK2CMP2P_R {
BK2CMP2P_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp3p(&self) -> BK2CMP3P_R {
BK2CMP3P_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn bk2cmp4p(&self) -> BK2CMP4P_R {
BK2CMP4P_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn ocrsel(&self) -> OCRSEL_R {
OCRSEL_R::new(((self.bits >> 16) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AF2")
.field("bk2ine", &self.bk2ine())
.field("bk2cmp1e", &self.bk2cmp1e())
.field("bk2cmp2e", &self.bk2cmp2e())
.field("bk2cmp3e", &self.bk2cmp3e())
.field("bk2cmp4e", &self.bk2cmp4e())
.field("bk2cmp5e", &self.bk2cmp5e())
.field("bk2cmp6e", &self.bk2cmp6e())
.field("bk2cmp7e", &self.bk2cmp7e())
.field("bk2cmp8e", &self.bk2cmp8e())
.field("bk2inp", &self.bk2inp())
.field("bk2cmp1p", &self.bk2cmp1p())
.field("bk2cmp2p", &self.bk2cmp2p())
.field("bk2cmp3p", &self.bk2cmp3p())
.field("bk2cmp4p", &self.bk2cmp4p())
.field("ocrsel", &self.ocrsel())
.finish()
}
}
impl W {
#[inline(always)]
pub fn bk2ine(&mut self) -> BK2INE_W<AF2rs> {
BK2INE_W::new(self, 0)
}
#[inline(always)]
pub fn bk2cmp1e(&mut self) -> BK2CMP1E_W<AF2rs> {
BK2CMP1E_W::new(self, 1)
}
#[inline(always)]
pub fn bk2cmp2e(&mut self) -> BK2CMP2E_W<AF2rs> {
BK2CMP2E_W::new(self, 2)
}
#[inline(always)]
pub fn bk2cmp3e(&mut self) -> BK2CMP3E_W<AF2rs> {
BK2CMP3E_W::new(self, 3)
}
#[inline(always)]
pub fn bk2cmp4e(&mut self) -> BK2CMP4E_W<AF2rs> {
BK2CMP4E_W::new(self, 4)
}
#[inline(always)]
pub fn bk2cmp5e(&mut self) -> BK2CMP5E_W<AF2rs> {
BK2CMP5E_W::new(self, 5)
}
#[inline(always)]
pub fn bk2cmp6e(&mut self) -> BK2CMP6E_W<AF2rs> {
BK2CMP6E_W::new(self, 6)
}
#[inline(always)]
pub fn bk2cmp7e(&mut self) -> BK2CMP7E_W<AF2rs> {
BK2CMP7E_W::new(self, 7)
}
#[inline(always)]
pub fn bk2cmp8e(&mut self) -> BK2CMP8E_W<AF2rs> {
BK2CMP8E_W::new(self, 8)
}
#[inline(always)]
pub fn bk2inp(&mut self) -> BK2INP_W<AF2rs> {
BK2INP_W::new(self, 9)
}
#[inline(always)]
pub fn bk2cmp1p(&mut self) -> BK2CMP1P_W<AF2rs> {
BK2CMP1P_W::new(self, 10)
}
#[inline(always)]
pub fn bk2cmp2p(&mut self) -> BK2CMP2P_W<AF2rs> {
BK2CMP2P_W::new(self, 11)
}
#[inline(always)]
pub fn bk2cmp3p(&mut self) -> BK2CMP3P_W<AF2rs> {
BK2CMP3P_W::new(self, 12)
}
#[inline(always)]
pub fn bk2cmp4p(&mut self) -> BK2CMP4P_W<AF2rs> {
BK2CMP4P_W::new(self, 13)
}
#[inline(always)]
pub fn ocrsel(&mut self) -> OCRSEL_W<AF2rs> {
OCRSEL_W::new(self, 16)
}
}
pub struct AF2rs;
impl crate::RegisterSpec for AF2rs {
type Ux = u32;
}
impl crate::Readable for AF2rs {}
impl crate::Writable for AF2rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for AF2rs {
const RESET_VALUE: u32 = 0x01;
}