pub type R = crate::R<CSRrs>;
pub type W = crate::W<CSRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LSION {
Off = 0,
On = 1,
}
impl From<LSION> for bool {
#[inline(always)]
fn from(variant: LSION) -> Self {
variant as u8 != 0
}
}
pub type LSION_R = crate::BitReader<LSION>;
impl LSION_R {
#[inline(always)]
pub const fn variant(&self) -> LSION {
match self.bits {
false => LSION::Off,
true => LSION::On,
}
}
#[inline(always)]
pub fn is_off(&self) -> bool {
*self == LSION::Off
}
#[inline(always)]
pub fn is_on(&self) -> bool {
*self == LSION::On
}
}
pub type LSION_W<'a, REG> = crate::BitWriter<'a, REG, LSION>;
impl<'a, REG> LSION_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn off(self) -> &'a mut crate::W<REG> {
self.variant(LSION::Off)
}
#[inline(always)]
pub fn on(self) -> &'a mut crate::W<REG> {
self.variant(LSION::On)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LSIRDY {
NotReady = 0,
Ready = 1,
}
impl From<LSIRDY> for bool {
#[inline(always)]
fn from(variant: LSIRDY) -> Self {
variant as u8 != 0
}
}
pub type LSIRDY_R = crate::BitReader<LSIRDY>;
impl LSIRDY_R {
#[inline(always)]
pub const fn variant(&self) -> LSIRDY {
match self.bits {
false => LSIRDY::NotReady,
true => LSIRDY::Ready,
}
}
#[inline(always)]
pub fn is_not_ready(&self) -> bool {
*self == LSIRDY::NotReady
}
#[inline(always)]
pub fn is_ready(&self) -> bool {
*self == LSIRDY::Ready
}
}
pub use LSION_R as LSEON_R;
pub use LSION_W as LSEON_W;
pub use LSIRDY_R as LSERDY_R;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LSEBYP {
NotBypassed = 0,
Bypassed = 1,
}
impl From<LSEBYP> for bool {
#[inline(always)]
fn from(variant: LSEBYP) -> Self {
variant as u8 != 0
}
}
pub type LSEBYP_R = crate::BitReader<LSEBYP>;
impl LSEBYP_R {
#[inline(always)]
pub const fn variant(&self) -> LSEBYP {
match self.bits {
false => LSEBYP::NotBypassed,
true => LSEBYP::Bypassed,
}
}
#[inline(always)]
pub fn is_not_bypassed(&self) -> bool {
*self == LSEBYP::NotBypassed
}
#[inline(always)]
pub fn is_bypassed(&self) -> bool {
*self == LSEBYP::Bypassed
}
}
pub type LSEBYP_W<'a, REG> = crate::BitWriter<'a, REG, LSEBYP>;
impl<'a, REG> LSEBYP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_bypassed(self) -> &'a mut crate::W<REG> {
self.variant(LSEBYP::NotBypassed)
}
#[inline(always)]
pub fn bypassed(self) -> &'a mut crate::W<REG> {
self.variant(LSEBYP::Bypassed)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum LSEDRV {
Low = 0,
MediumLow = 1,
MediumHigh = 2,
High = 3,
}
impl From<LSEDRV> for u8 {
#[inline(always)]
fn from(variant: LSEDRV) -> Self {
variant as _
}
}
impl crate::FieldSpec for LSEDRV {
type Ux = u8;
}
impl crate::IsEnum for LSEDRV {}
pub type LSEDRV_R = crate::FieldReader<LSEDRV>;
impl LSEDRV_R {
#[inline(always)]
pub const fn variant(&self) -> LSEDRV {
match self.bits {
0 => LSEDRV::Low,
1 => LSEDRV::MediumLow,
2 => LSEDRV::MediumHigh,
3 => LSEDRV::High,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_low(&self) -> bool {
*self == LSEDRV::Low
}
#[inline(always)]
pub fn is_medium_low(&self) -> bool {
*self == LSEDRV::MediumLow
}
#[inline(always)]
pub fn is_medium_high(&self) -> bool {
*self == LSEDRV::MediumHigh
}
#[inline(always)]
pub fn is_high(&self) -> bool {
*self == LSEDRV::High
}
}
pub type LSEDRV_W<'a, REG> = crate::FieldWriter<'a, REG, 2, LSEDRV, crate::Safe>;
impl<'a, REG> LSEDRV_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn low(self) -> &'a mut crate::W<REG> {
self.variant(LSEDRV::Low)
}
#[inline(always)]
pub fn medium_low(self) -> &'a mut crate::W<REG> {
self.variant(LSEDRV::MediumLow)
}
#[inline(always)]
pub fn medium_high(self) -> &'a mut crate::W<REG> {
self.variant(LSEDRV::MediumHigh)
}
#[inline(always)]
pub fn high(self) -> &'a mut crate::W<REG> {
self.variant(LSEDRV::High)
}
}
pub use LSION_R as CSSLSEON_R;
pub use LSION_W as CSSLSEON_W;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CSSLSED {
NoFailure = 0,
Failure = 1,
}
impl From<CSSLSED> for bool {
#[inline(always)]
fn from(variant: CSSLSED) -> Self {
variant as u8 != 0
}
}
pub type CSSLSED_R = crate::BitReader<CSSLSED>;
impl CSSLSED_R {
#[inline(always)]
pub const fn variant(&self) -> CSSLSED {
match self.bits {
false => CSSLSED::NoFailure,
true => CSSLSED::Failure,
}
}
#[inline(always)]
pub fn is_no_failure(&self) -> bool {
*self == CSSLSED::NoFailure
}
#[inline(always)]
pub fn is_failure(&self) -> bool {
*self == CSSLSED::Failure
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RTCSEL {
NoClock = 0,
Lse = 1,
Lsi = 2,
Hse = 3,
}
impl From<RTCSEL> for u8 {
#[inline(always)]
fn from(variant: RTCSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for RTCSEL {
type Ux = u8;
}
impl crate::IsEnum for RTCSEL {}
pub type RTCSEL_R = crate::FieldReader<RTCSEL>;
impl RTCSEL_R {
#[inline(always)]
pub const fn variant(&self) -> RTCSEL {
match self.bits {
0 => RTCSEL::NoClock,
1 => RTCSEL::Lse,
2 => RTCSEL::Lsi,
3 => RTCSEL::Hse,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_no_clock(&self) -> bool {
*self == RTCSEL::NoClock
}
#[inline(always)]
pub fn is_lse(&self) -> bool {
*self == RTCSEL::Lse
}
#[inline(always)]
pub fn is_lsi(&self) -> bool {
*self == RTCSEL::Lsi
}
#[inline(always)]
pub fn is_hse(&self) -> bool {
*self == RTCSEL::Hse
}
}
pub type RTCSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, RTCSEL, crate::Safe>;
impl<'a, REG> RTCSEL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn no_clock(self) -> &'a mut crate::W<REG> {
self.variant(RTCSEL::NoClock)
}
#[inline(always)]
pub fn lse(self) -> &'a mut crate::W<REG> {
self.variant(RTCSEL::Lse)
}
#[inline(always)]
pub fn lsi(self) -> &'a mut crate::W<REG> {
self.variant(RTCSEL::Lsi)
}
#[inline(always)]
pub fn hse(self) -> &'a mut crate::W<REG> {
self.variant(RTCSEL::Hse)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RTCEN {
Disabled = 0,
Enabled = 1,
}
impl From<RTCEN> for bool {
#[inline(always)]
fn from(variant: RTCEN) -> Self {
variant as u8 != 0
}
}
pub type RTCEN_R = crate::BitReader<RTCEN>;
impl RTCEN_R {
#[inline(always)]
pub const fn variant(&self) -> RTCEN {
match self.bits {
false => RTCEN::Disabled,
true => RTCEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RTCEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RTCEN::Enabled
}
}
pub type RTCEN_W<'a, REG> = crate::BitWriter<'a, REG, RTCEN>;
impl<'a, REG> RTCEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(RTCEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(RTCEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RTCRSTW {
Reset = 1,
}
impl From<RTCRSTW> for bool {
#[inline(always)]
fn from(variant: RTCRSTW) -> Self {
variant as u8 != 0
}
}
pub type RTCRST_R = crate::BitReader<RTCRSTW>;
impl RTCRST_R {
#[inline(always)]
pub const fn variant(&self) -> Option<RTCRSTW> {
match self.bits {
true => Some(RTCRSTW::Reset),
_ => None,
}
}
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == RTCRSTW::Reset
}
}
pub type RTCRST_W<'a, REG> = crate::BitWriter<'a, REG, RTCRSTW>;
impl<'a, REG> RTCRST_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn reset(self) -> &'a mut crate::W<REG> {
self.variant(RTCRSTW::Reset)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RMVFW {
Clear = 1,
}
impl From<RMVFW> for bool {
#[inline(always)]
fn from(variant: RMVFW) -> Self {
variant as u8 != 0
}
}
pub type RMVF_R = crate::BitReader<RMVFW>;
impl RMVF_R {
#[inline(always)]
pub const fn variant(&self) -> Option<RMVFW> {
match self.bits {
true => Some(RMVFW::Clear),
_ => None,
}
}
#[inline(always)]
pub fn is_clear(&self) -> bool {
*self == RMVFW::Clear
}
}
pub type RMVF_W<'a, REG> = crate::BitWriter<'a, REG, RMVFW>;
impl<'a, REG> RMVF_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn clear(self) -> &'a mut crate::W<REG> {
self.variant(RMVFW::Clear)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FWRSTFR {
NoReset = 0,
Reset = 1,
}
impl From<FWRSTFR> for bool {
#[inline(always)]
fn from(variant: FWRSTFR) -> Self {
variant as u8 != 0
}
}
pub type FWRSTF_R = crate::BitReader<FWRSTFR>;
impl FWRSTF_R {
#[inline(always)]
pub const fn variant(&self) -> FWRSTFR {
match self.bits {
false => FWRSTFR::NoReset,
true => FWRSTFR::Reset,
}
}
#[inline(always)]
pub fn is_no_reset(&self) -> bool {
*self == FWRSTFR::NoReset
}
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == FWRSTFR::Reset
}
}
pub use FWRSTF_R as OBLRSTF_R;
pub use FWRSTF_R as PINRSTF_R;
pub use FWRSTF_R as PORRSTF_R;
pub use FWRSTF_R as SFTRSTF_R;
pub use FWRSTF_R as IWDGRSTF_R;
pub use FWRSTF_R as WWDGRSTF_R;
pub use FWRSTF_R as LPWRRSTF_R;
impl R {
#[inline(always)]
pub fn lsion(&self) -> LSION_R {
LSION_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn lsirdy(&self) -> LSIRDY_R {
LSIRDY_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn lseon(&self) -> LSEON_R {
LSEON_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn lserdy(&self) -> LSERDY_R {
LSERDY_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn lsebyp(&self) -> LSEBYP_R {
LSEBYP_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn lsedrv(&self) -> LSEDRV_R {
LSEDRV_R::new(((self.bits >> 11) & 3) as u8)
}
#[inline(always)]
pub fn csslseon(&self) -> CSSLSEON_R {
CSSLSEON_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn csslsed(&self) -> CSSLSED_R {
CSSLSED_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn rtcsel(&self) -> RTCSEL_R {
RTCSEL_R::new(((self.bits >> 16) & 3) as u8)
}
#[inline(always)]
pub fn rtcen(&self) -> RTCEN_R {
RTCEN_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn rtcrst(&self) -> RTCRST_R {
RTCRST_R::new(((self.bits >> 19) & 1) != 0)
}
#[inline(always)]
pub fn rmvf(&self) -> RMVF_R {
RMVF_R::new(((self.bits >> 23) & 1) != 0)
}
#[inline(always)]
pub fn fwrstf(&self) -> FWRSTF_R {
FWRSTF_R::new(((self.bits >> 24) & 1) != 0)
}
#[inline(always)]
pub fn oblrstf(&self) -> OBLRSTF_R {
OBLRSTF_R::new(((self.bits >> 25) & 1) != 0)
}
#[inline(always)]
pub fn pinrstf(&self) -> PINRSTF_R {
PINRSTF_R::new(((self.bits >> 26) & 1) != 0)
}
#[inline(always)]
pub fn porrstf(&self) -> PORRSTF_R {
PORRSTF_R::new(((self.bits >> 27) & 1) != 0)
}
#[inline(always)]
pub fn sftrstf(&self) -> SFTRSTF_R {
SFTRSTF_R::new(((self.bits >> 28) & 1) != 0)
}
#[inline(always)]
pub fn iwdgrstf(&self) -> IWDGRSTF_R {
IWDGRSTF_R::new(((self.bits >> 29) & 1) != 0)
}
#[inline(always)]
pub fn wwdgrstf(&self) -> WWDGRSTF_R {
WWDGRSTF_R::new(((self.bits >> 30) & 1) != 0)
}
#[inline(always)]
pub fn lpwrrstf(&self) -> LPWRRSTF_R {
LPWRRSTF_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("CSR")
.field("fwrstf", &self.fwrstf())
.field("lpwrrstf", &self.lpwrrstf())
.field("wwdgrstf", &self.wwdgrstf())
.field("iwdgrstf", &self.iwdgrstf())
.field("sftrstf", &self.sftrstf())
.field("porrstf", &self.porrstf())
.field("pinrstf", &self.pinrstf())
.field("oblrstf", &self.oblrstf())
.field("rmvf", &self.rmvf())
.field("rtcrst", &self.rtcrst())
.field("rtcen", &self.rtcen())
.field("rtcsel", &self.rtcsel())
.field("csslsed", &self.csslsed())
.field("lsion", &self.lsion())
.field("csslseon", &self.csslseon())
.field("lsedrv", &self.lsedrv())
.field("lsebyp", &self.lsebyp())
.field("lsirdy", &self.lsirdy())
.field("lserdy", &self.lserdy())
.field("lseon", &self.lseon())
.finish()
}
}
impl W {
#[inline(always)]
pub fn lsion(&mut self) -> LSION_W<CSRrs> {
LSION_W::new(self, 0)
}
#[inline(always)]
pub fn lseon(&mut self) -> LSEON_W<CSRrs> {
LSEON_W::new(self, 8)
}
#[inline(always)]
pub fn lsebyp(&mut self) -> LSEBYP_W<CSRrs> {
LSEBYP_W::new(self, 10)
}
#[inline(always)]
pub fn lsedrv(&mut self) -> LSEDRV_W<CSRrs> {
LSEDRV_W::new(self, 11)
}
#[inline(always)]
pub fn csslseon(&mut self) -> CSSLSEON_W<CSRrs> {
CSSLSEON_W::new(self, 13)
}
#[inline(always)]
pub fn rtcsel(&mut self) -> RTCSEL_W<CSRrs> {
RTCSEL_W::new(self, 16)
}
#[inline(always)]
pub fn rtcen(&mut self) -> RTCEN_W<CSRrs> {
RTCEN_W::new(self, 18)
}
#[inline(always)]
pub fn rtcrst(&mut self) -> RTCRST_W<CSRrs> {
RTCRST_W::new(self, 19)
}
#[inline(always)]
pub fn rmvf(&mut self) -> RMVF_W<CSRrs> {
RMVF_W::new(self, 23)
}
}
pub struct CSRrs;
impl crate::RegisterSpec for CSRrs {
type Ux = u32;
}
impl crate::Readable for CSRrs {}
impl crate::Writable for CSRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CSRrs {
const RESET_VALUE: u32 = 0x0c00_0000;
}