pub type R = crate::R<CRrs>;
pub type W = crate::W<CRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EN1 {
Disabled = 0,
Enabled = 1,
}
impl From<EN1> for bool {
#[inline(always)]
fn from(variant: EN1) -> Self {
variant as u8 != 0
}
}
pub type EN1_R = crate::BitReader<EN1>;
impl EN1_R {
#[inline(always)]
pub const fn variant(&self) -> EN1 {
match self.bits {
false => EN1::Disabled,
true => EN1::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == EN1::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == EN1::Enabled
}
}
pub type EN1_W<'a, REG> = crate::BitWriter<'a, REG, EN1>;
impl<'a, REG> EN1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(EN1::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(EN1::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BOFF1 {
Enabled = 0,
Disabled = 1,
}
impl From<BOFF1> for bool {
#[inline(always)]
fn from(variant: BOFF1) -> Self {
variant as u8 != 0
}
}
pub type BOFF1_R = crate::BitReader<BOFF1>;
impl BOFF1_R {
#[inline(always)]
pub const fn variant(&self) -> BOFF1 {
match self.bits {
false => BOFF1::Enabled,
true => BOFF1::Disabled,
}
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == BOFF1::Enabled
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == BOFF1::Disabled
}
}
pub type BOFF1_W<'a, REG> = crate::BitWriter<'a, REG, BOFF1>;
impl<'a, REG> BOFF1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(BOFF1::Enabled)
}
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(BOFF1::Disabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TEN1 {
Disabled = 0,
Enabled = 1,
}
impl From<TEN1> for bool {
#[inline(always)]
fn from(variant: TEN1) -> Self {
variant as u8 != 0
}
}
pub type TEN1_R = crate::BitReader<TEN1>;
impl TEN1_R {
#[inline(always)]
pub const fn variant(&self) -> TEN1 {
match self.bits {
false => TEN1::Disabled,
true => TEN1::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TEN1::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TEN1::Enabled
}
}
pub type TEN1_W<'a, REG> = crate::BitWriter<'a, REG, TEN1>;
impl<'a, REG> TEN1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(TEN1::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(TEN1::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TSEL1 {
Tim6Trgo = 0,
Tim3Trgo = 1,
Tim7Trgo = 2,
Tim15Trgo = 3,
Tim2Trgo = 4,
Exti9 = 6,
Software = 7,
}
impl From<TSEL1> for u8 {
#[inline(always)]
fn from(variant: TSEL1) -> Self {
variant as _
}
}
impl crate::FieldSpec for TSEL1 {
type Ux = u8;
}
impl crate::IsEnum for TSEL1 {}
pub type TSEL1_R = crate::FieldReader<TSEL1>;
impl TSEL1_R {
#[inline(always)]
pub const fn variant(&self) -> Option<TSEL1> {
match self.bits {
0 => Some(TSEL1::Tim6Trgo),
1 => Some(TSEL1::Tim3Trgo),
2 => Some(TSEL1::Tim7Trgo),
3 => Some(TSEL1::Tim15Trgo),
4 => Some(TSEL1::Tim2Trgo),
6 => Some(TSEL1::Exti9),
7 => Some(TSEL1::Software),
_ => None,
}
}
#[inline(always)]
pub fn is_tim6_trgo(&self) -> bool {
*self == TSEL1::Tim6Trgo
}
#[inline(always)]
pub fn is_tim3_trgo(&self) -> bool {
*self == TSEL1::Tim3Trgo
}
#[inline(always)]
pub fn is_tim7_trgo(&self) -> bool {
*self == TSEL1::Tim7Trgo
}
#[inline(always)]
pub fn is_tim15_trgo(&self) -> bool {
*self == TSEL1::Tim15Trgo
}
#[inline(always)]
pub fn is_tim2_trgo(&self) -> bool {
*self == TSEL1::Tim2Trgo
}
#[inline(always)]
pub fn is_exti9(&self) -> bool {
*self == TSEL1::Exti9
}
#[inline(always)]
pub fn is_software(&self) -> bool {
*self == TSEL1::Software
}
}
pub type TSEL1_W<'a, REG> = crate::FieldWriter<'a, REG, 3, TSEL1>;
impl<'a, REG> TSEL1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn tim6_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL1::Tim6Trgo)
}
#[inline(always)]
pub fn tim3_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL1::Tim3Trgo)
}
#[inline(always)]
pub fn tim7_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL1::Tim7Trgo)
}
#[inline(always)]
pub fn tim15_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL1::Tim15Trgo)
}
#[inline(always)]
pub fn tim2_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL1::Tim2Trgo)
}
#[inline(always)]
pub fn exti9(self) -> &'a mut crate::W<REG> {
self.variant(TSEL1::Exti9)
}
#[inline(always)]
pub fn software(self) -> &'a mut crate::W<REG> {
self.variant(TSEL1::Software)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum WAVE1 {
Disabled = 0,
Noise = 1,
Triangle = 2,
}
impl From<WAVE1> for u8 {
#[inline(always)]
fn from(variant: WAVE1) -> Self {
variant as _
}
}
impl crate::FieldSpec for WAVE1 {
type Ux = u8;
}
impl crate::IsEnum for WAVE1 {}
pub type WAVE1_R = crate::FieldReader<WAVE1>;
impl WAVE1_R {
#[inline(always)]
pub const fn variant(&self) -> Option<WAVE1> {
match self.bits {
0 => Some(WAVE1::Disabled),
1 => Some(WAVE1::Noise),
2 => Some(WAVE1::Triangle),
_ => None,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == WAVE1::Disabled
}
#[inline(always)]
pub fn is_noise(&self) -> bool {
*self == WAVE1::Noise
}
#[inline(always)]
pub fn is_triangle(&self) -> bool {
*self == WAVE1::Triangle
}
}
pub type WAVE1_W<'a, REG> = crate::FieldWriter<'a, REG, 2, WAVE1>;
impl<'a, REG> WAVE1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(WAVE1::Disabled)
}
#[inline(always)]
pub fn noise(self) -> &'a mut crate::W<REG> {
self.variant(WAVE1::Noise)
}
#[inline(always)]
pub fn triangle(self) -> &'a mut crate::W<REG> {
self.variant(WAVE1::Triangle)
}
}
pub type MAMP1_R = crate::FieldReader;
pub type MAMP1_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAEN1 {
Disabled = 0,
Enabled = 1,
}
impl From<DMAEN1> for bool {
#[inline(always)]
fn from(variant: DMAEN1) -> Self {
variant as u8 != 0
}
}
pub type DMAEN1_R = crate::BitReader<DMAEN1>;
impl DMAEN1_R {
#[inline(always)]
pub const fn variant(&self) -> DMAEN1 {
match self.bits {
false => DMAEN1::Disabled,
true => DMAEN1::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMAEN1::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMAEN1::Enabled
}
}
pub type DMAEN1_W<'a, REG> = crate::BitWriter<'a, REG, DMAEN1>;
impl<'a, REG> DMAEN1_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAEN1::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMAEN1::Enabled)
}
}
pub use BOFF1_R as BOFF2_R;
pub use BOFF1_W as BOFF2_W;
pub use EN1_R as EN2_R;
pub use EN1_W as EN2_W;
pub use TEN1_R as TEN2_R;
pub use TEN1_W as TEN2_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum TSEL2 {
Tim6Trgo = 0,
Tim8Trgo = 1,
Tim7Trgo = 2,
Tim5Trgo = 3,
Tim2Trgo = 4,
Tim4Trgo = 5,
Exti9 = 6,
Software = 7,
}
impl From<TSEL2> for u8 {
#[inline(always)]
fn from(variant: TSEL2) -> Self {
variant as _
}
}
impl crate::FieldSpec for TSEL2 {
type Ux = u8;
}
impl crate::IsEnum for TSEL2 {}
pub type TSEL2_R = crate::FieldReader<TSEL2>;
impl TSEL2_R {
#[inline(always)]
pub const fn variant(&self) -> TSEL2 {
match self.bits {
0 => TSEL2::Tim6Trgo,
1 => TSEL2::Tim8Trgo,
2 => TSEL2::Tim7Trgo,
3 => TSEL2::Tim5Trgo,
4 => TSEL2::Tim2Trgo,
5 => TSEL2::Tim4Trgo,
6 => TSEL2::Exti9,
7 => TSEL2::Software,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_tim6_trgo(&self) -> bool {
*self == TSEL2::Tim6Trgo
}
#[inline(always)]
pub fn is_tim8_trgo(&self) -> bool {
*self == TSEL2::Tim8Trgo
}
#[inline(always)]
pub fn is_tim7_trgo(&self) -> bool {
*self == TSEL2::Tim7Trgo
}
#[inline(always)]
pub fn is_tim5_trgo(&self) -> bool {
*self == TSEL2::Tim5Trgo
}
#[inline(always)]
pub fn is_tim2_trgo(&self) -> bool {
*self == TSEL2::Tim2Trgo
}
#[inline(always)]
pub fn is_tim4_trgo(&self) -> bool {
*self == TSEL2::Tim4Trgo
}
#[inline(always)]
pub fn is_exti9(&self) -> bool {
*self == TSEL2::Exti9
}
#[inline(always)]
pub fn is_software(&self) -> bool {
*self == TSEL2::Software
}
}
pub type TSEL2_W<'a, REG> = crate::FieldWriter<'a, REG, 3, TSEL2, crate::Safe>;
impl<'a, REG> TSEL2_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn tim6_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL2::Tim6Trgo)
}
#[inline(always)]
pub fn tim8_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL2::Tim8Trgo)
}
#[inline(always)]
pub fn tim7_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL2::Tim7Trgo)
}
#[inline(always)]
pub fn tim5_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL2::Tim5Trgo)
}
#[inline(always)]
pub fn tim2_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL2::Tim2Trgo)
}
#[inline(always)]
pub fn tim4_trgo(self) -> &'a mut crate::W<REG> {
self.variant(TSEL2::Tim4Trgo)
}
#[inline(always)]
pub fn exti9(self) -> &'a mut crate::W<REG> {
self.variant(TSEL2::Exti9)
}
#[inline(always)]
pub fn software(self) -> &'a mut crate::W<REG> {
self.variant(TSEL2::Software)
}
}
pub use WAVE1_R as WAVE2_R;
pub use WAVE1_W as WAVE2_W;
pub type MAMP2_R = crate::FieldReader;
pub type MAMP2_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
pub use DMAEN1_R as DMAEN2_R;
pub use DMAEN1_W as DMAEN2_W;
impl R {
#[inline(always)]
pub fn en1(&self) -> EN1_R {
EN1_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn boff1(&self) -> BOFF1_R {
BOFF1_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn ten1(&self) -> TEN1_R {
TEN1_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn tsel1(&self) -> TSEL1_R {
TSEL1_R::new(((self.bits >> 3) & 7) as u8)
}
#[inline(always)]
pub fn wave1(&self) -> WAVE1_R {
WAVE1_R::new(((self.bits >> 6) & 3) as u8)
}
#[inline(always)]
pub fn mamp1(&self) -> MAMP1_R {
MAMP1_R::new(((self.bits >> 8) & 0x0f) as u8)
}
#[inline(always)]
pub fn dmaen1(&self) -> DMAEN1_R {
DMAEN1_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn en2(&self) -> EN2_R {
EN2_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn boff2(&self) -> BOFF2_R {
BOFF2_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn ten2(&self) -> TEN2_R {
TEN2_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn tsel2(&self) -> TSEL2_R {
TSEL2_R::new(((self.bits >> 19) & 7) as u8)
}
#[inline(always)]
pub fn wave2(&self) -> WAVE2_R {
WAVE2_R::new(((self.bits >> 22) & 3) as u8)
}
#[inline(always)]
pub fn mamp2(&self) -> MAMP2_R {
MAMP2_R::new(((self.bits >> 24) & 0x0f) as u8)
}
#[inline(always)]
pub fn dmaen2(&self) -> DMAEN2_R {
DMAEN2_R::new(((self.bits >> 28) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR")
.field("en1", &self.en1())
.field("boff1", &self.boff1())
.field("ten1", &self.ten1())
.field("tsel1", &self.tsel1())
.field("wave1", &self.wave1())
.field("mamp1", &self.mamp1())
.field("dmaen1", &self.dmaen1())
.field("en2", &self.en2())
.field("boff2", &self.boff2())
.field("ten2", &self.ten2())
.field("tsel2", &self.tsel2())
.field("wave2", &self.wave2())
.field("mamp2", &self.mamp2())
.field("dmaen2", &self.dmaen2())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn en1(&mut self) -> EN1_W<CRrs> {
EN1_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn boff1(&mut self) -> BOFF1_W<CRrs> {
BOFF1_W::new(self, 1)
}
#[inline(always)]
#[must_use]
pub fn ten1(&mut self) -> TEN1_W<CRrs> {
TEN1_W::new(self, 2)
}
#[inline(always)]
#[must_use]
pub fn tsel1(&mut self) -> TSEL1_W<CRrs> {
TSEL1_W::new(self, 3)
}
#[inline(always)]
#[must_use]
pub fn wave1(&mut self) -> WAVE1_W<CRrs> {
WAVE1_W::new(self, 6)
}
#[inline(always)]
#[must_use]
pub fn mamp1(&mut self) -> MAMP1_W<CRrs> {
MAMP1_W::new(self, 8)
}
#[inline(always)]
#[must_use]
pub fn dmaen1(&mut self) -> DMAEN1_W<CRrs> {
DMAEN1_W::new(self, 12)
}
#[inline(always)]
#[must_use]
pub fn en2(&mut self) -> EN2_W<CRrs> {
EN2_W::new(self, 16)
}
#[inline(always)]
#[must_use]
pub fn boff2(&mut self) -> BOFF2_W<CRrs> {
BOFF2_W::new(self, 17)
}
#[inline(always)]
#[must_use]
pub fn ten2(&mut self) -> TEN2_W<CRrs> {
TEN2_W::new(self, 18)
}
#[inline(always)]
#[must_use]
pub fn tsel2(&mut self) -> TSEL2_W<CRrs> {
TSEL2_W::new(self, 19)
}
#[inline(always)]
#[must_use]
pub fn wave2(&mut self) -> WAVE2_W<CRrs> {
WAVE2_W::new(self, 22)
}
#[inline(always)]
#[must_use]
pub fn mamp2(&mut self) -> MAMP2_W<CRrs> {
MAMP2_W::new(self, 24)
}
#[inline(always)]
#[must_use]
pub fn dmaen2(&mut self) -> DMAEN2_W<CRrs> {
DMAEN2_W::new(self, 28)
}
}
pub struct CRrs;
impl crate::RegisterSpec for CRrs {
type Ux = u32;
}
impl crate::Readable for CRrs {}
impl crate::Writable for CRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for CRrs {
const RESET_VALUE: u32 = 0;
}