pub type R = crate::R<CLKCRrs>;
pub type W = crate::W<CLKCRrs>;
pub type CLKDIV_R = crate::FieldReader;
pub type CLKDIV_W<'a, REG> = crate::FieldWriter<'a, REG, 8, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CLKEN {
Disabled = 0,
Enabled = 1,
}
impl From<CLKEN> for bool {
#[inline(always)]
fn from(variant: CLKEN) -> Self {
variant as u8 != 0
}
}
pub type CLKEN_R = crate::BitReader<CLKEN>;
impl CLKEN_R {
#[inline(always)]
pub const fn variant(&self) -> CLKEN {
match self.bits {
false => CLKEN::Disabled,
true => CLKEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CLKEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CLKEN::Enabled
}
}
pub type CLKEN_W<'a, REG> = crate::BitWriter<'a, REG, CLKEN>;
impl<'a, REG> CLKEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CLKEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CLKEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PWRSAV {
Enabled = 0,
Disabled = 1,
}
impl From<PWRSAV> for bool {
#[inline(always)]
fn from(variant: PWRSAV) -> Self {
variant as u8 != 0
}
}
pub type PWRSAV_R = crate::BitReader<PWRSAV>;
impl PWRSAV_R {
#[inline(always)]
pub const fn variant(&self) -> PWRSAV {
match self.bits {
false => PWRSAV::Enabled,
true => PWRSAV::Disabled,
}
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PWRSAV::Enabled
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PWRSAV::Disabled
}
}
pub type PWRSAV_W<'a, REG> = crate::BitWriter<'a, REG, PWRSAV>;
impl<'a, REG> PWRSAV_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(PWRSAV::Enabled)
}
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(PWRSAV::Disabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BYPASS {
Disabled = 0,
Enabled = 1,
}
impl From<BYPASS> for bool {
#[inline(always)]
fn from(variant: BYPASS) -> Self {
variant as u8 != 0
}
}
pub type BYPASS_R = crate::BitReader<BYPASS>;
impl BYPASS_R {
#[inline(always)]
pub const fn variant(&self) -> BYPASS {
match self.bits {
false => BYPASS::Disabled,
true => BYPASS::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == BYPASS::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == BYPASS::Enabled
}
}
pub type BYPASS_W<'a, REG> = crate::BitWriter<'a, REG, BYPASS>;
impl<'a, REG> BYPASS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(BYPASS::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(BYPASS::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum WIDBUS {
BusWidth1 = 0,
BusWidth4 = 1,
BusWidth8 = 2,
}
impl From<WIDBUS> for u8 {
#[inline(always)]
fn from(variant: WIDBUS) -> Self {
variant as _
}
}
impl crate::FieldSpec for WIDBUS {
type Ux = u8;
}
impl crate::IsEnum for WIDBUS {}
pub type WIDBUS_R = crate::FieldReader<WIDBUS>;
impl WIDBUS_R {
#[inline(always)]
pub const fn variant(&self) -> Option<WIDBUS> {
match self.bits {
0 => Some(WIDBUS::BusWidth1),
1 => Some(WIDBUS::BusWidth4),
2 => Some(WIDBUS::BusWidth8),
_ => None,
}
}
#[inline(always)]
pub fn is_bus_width1(&self) -> bool {
*self == WIDBUS::BusWidth1
}
#[inline(always)]
pub fn is_bus_width4(&self) -> bool {
*self == WIDBUS::BusWidth4
}
#[inline(always)]
pub fn is_bus_width8(&self) -> bool {
*self == WIDBUS::BusWidth8
}
}
pub type WIDBUS_W<'a, REG> = crate::FieldWriter<'a, REG, 2, WIDBUS>;
impl<'a, REG> WIDBUS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn bus_width1(self) -> &'a mut crate::W<REG> {
self.variant(WIDBUS::BusWidth1)
}
#[inline(always)]
pub fn bus_width4(self) -> &'a mut crate::W<REG> {
self.variant(WIDBUS::BusWidth4)
}
#[inline(always)]
pub fn bus_width8(self) -> &'a mut crate::W<REG> {
self.variant(WIDBUS::BusWidth8)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum NEGEDGE {
Rising = 0,
Falling = 1,
}
impl From<NEGEDGE> for bool {
#[inline(always)]
fn from(variant: NEGEDGE) -> Self {
variant as u8 != 0
}
}
pub type NEGEDGE_R = crate::BitReader<NEGEDGE>;
impl NEGEDGE_R {
#[inline(always)]
pub const fn variant(&self) -> NEGEDGE {
match self.bits {
false => NEGEDGE::Rising,
true => NEGEDGE::Falling,
}
}
#[inline(always)]
pub fn is_rising(&self) -> bool {
*self == NEGEDGE::Rising
}
#[inline(always)]
pub fn is_falling(&self) -> bool {
*self == NEGEDGE::Falling
}
}
pub type NEGEDGE_W<'a, REG> = crate::BitWriter<'a, REG, NEGEDGE>;
impl<'a, REG> NEGEDGE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn rising(self) -> &'a mut crate::W<REG> {
self.variant(NEGEDGE::Rising)
}
#[inline(always)]
pub fn falling(self) -> &'a mut crate::W<REG> {
self.variant(NEGEDGE::Falling)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum HWFC_EN {
Disabled = 0,
Enabled = 1,
}
impl From<HWFC_EN> for bool {
#[inline(always)]
fn from(variant: HWFC_EN) -> Self {
variant as u8 != 0
}
}
pub type HWFC_EN_R = crate::BitReader<HWFC_EN>;
impl HWFC_EN_R {
#[inline(always)]
pub const fn variant(&self) -> HWFC_EN {
match self.bits {
false => HWFC_EN::Disabled,
true => HWFC_EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == HWFC_EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == HWFC_EN::Enabled
}
}
pub type HWFC_EN_W<'a, REG> = crate::BitWriter<'a, REG, HWFC_EN>;
impl<'a, REG> HWFC_EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(HWFC_EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(HWFC_EN::Enabled)
}
}
impl R {
#[inline(always)]
pub fn clkdiv(&self) -> CLKDIV_R {
CLKDIV_R::new((self.bits & 0xff) as u8)
}
#[inline(always)]
pub fn clken(&self) -> CLKEN_R {
CLKEN_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn pwrsav(&self) -> PWRSAV_R {
PWRSAV_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn bypass(&self) -> BYPASS_R {
BYPASS_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn widbus(&self) -> WIDBUS_R {
WIDBUS_R::new(((self.bits >> 11) & 3) as u8)
}
#[inline(always)]
pub fn negedge(&self) -> NEGEDGE_R {
NEGEDGE_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn hwfc_en(&self) -> HWFC_EN_R {
HWFC_EN_R::new(((self.bits >> 14) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CLKCR")
.field("hwfc_en", &self.hwfc_en())
.field("negedge", &self.negedge())
.field("widbus", &self.widbus())
.field("bypass", &self.bypass())
.field("pwrsav", &self.pwrsav())
.field("clken", &self.clken())
.field("clkdiv", &self.clkdiv())
.finish()
}
}
impl W {
#[inline(always)]
pub fn clkdiv(&mut self) -> CLKDIV_W<CLKCRrs> {
CLKDIV_W::new(self, 0)
}
#[inline(always)]
pub fn clken(&mut self) -> CLKEN_W<CLKCRrs> {
CLKEN_W::new(self, 8)
}
#[inline(always)]
pub fn pwrsav(&mut self) -> PWRSAV_W<CLKCRrs> {
PWRSAV_W::new(self, 9)
}
#[inline(always)]
pub fn bypass(&mut self) -> BYPASS_W<CLKCRrs> {
BYPASS_W::new(self, 10)
}
#[inline(always)]
pub fn widbus(&mut self) -> WIDBUS_W<CLKCRrs> {
WIDBUS_W::new(self, 11)
}
#[inline(always)]
pub fn negedge(&mut self) -> NEGEDGE_W<CLKCRrs> {
NEGEDGE_W::new(self, 13)
}
#[inline(always)]
pub fn hwfc_en(&mut self) -> HWFC_EN_W<CLKCRrs> {
HWFC_EN_W::new(self, 14)
}
}
pub struct CLKCRrs;
impl crate::RegisterSpec for CLKCRrs {
type Ux = u32;
}
impl crate::Readable for CLKCRrs {}
impl crate::Writable for CLKCRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CLKCRrs {}