#[doc = "Register `BDCR` reader"]
pub struct R(crate::R<BDCR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<BDCR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<BDCR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<BDCR_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `BDCR` writer"]
pub struct W(crate::W<BDCR_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<BDCR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<BDCR_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<BDCR_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `LSCOSEL` reader - Low speed clock output selection"]
pub struct LSCOSEL_R(crate::FieldReader<bool, bool>);
impl LSCOSEL_R {
pub(crate) fn new(bits: bool) -> Self {
LSCOSEL_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSCOSEL_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSCOSEL` writer - Low speed clock output selection"]
pub struct LSCOSEL_W<'a> {
w: &'a mut W,
}
impl<'a> LSCOSEL_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 25)) | ((value as u32 & 0x01) << 25);
self.w
}
}
#[doc = "Field `LSCOEN` reader - Low speed clock output enable"]
pub struct LSCOEN_R(crate::FieldReader<bool, bool>);
impl LSCOEN_R {
pub(crate) fn new(bits: bool) -> Self {
LSCOEN_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSCOEN_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSCOEN` writer - Low speed clock output enable"]
pub struct LSCOEN_W<'a> {
w: &'a mut W,
}
impl<'a> LSCOEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
self.w
}
}
#[doc = "Field `BDRST` reader - Backup domain software reset"]
pub struct BDRST_R(crate::FieldReader<bool, bool>);
impl BDRST_R {
pub(crate) fn new(bits: bool) -> Self {
BDRST_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for BDRST_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `BDRST` writer - Backup domain software reset"]
pub struct BDRST_W<'a> {
w: &'a mut W,
}
impl<'a> BDRST_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
self.w
}
}
#[doc = "Field `RTCEN` reader - RTC clock enable"]
pub struct RTCEN_R(crate::FieldReader<bool, bool>);
impl RTCEN_R {
pub(crate) fn new(bits: bool) -> Self {
RTCEN_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for RTCEN_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RTCEN` writer - RTC clock enable"]
pub struct RTCEN_W<'a> {
w: &'a mut W,
}
impl<'a> RTCEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
self.w
}
}
#[doc = "Field `RTCSEL` reader - RTC clock source selection"]
pub struct RTCSEL_R(crate::FieldReader<u8, u8>);
impl RTCSEL_R {
pub(crate) fn new(bits: u8) -> Self {
RTCSEL_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for RTCSEL_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `RTCSEL` writer - RTC clock source selection"]
pub struct RTCSEL_W<'a> {
w: &'a mut W,
}
impl<'a> RTCSEL_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 8)) | ((value as u32 & 0x03) << 8);
self.w
}
}
#[doc = "Field `LSECSSD` reader - LSECSSD"]
pub struct LSECSSD_R(crate::FieldReader<bool, bool>);
impl LSECSSD_R {
pub(crate) fn new(bits: bool) -> Self {
LSECSSD_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSECSSD_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSECSSON` reader - LSECSSON"]
pub struct LSECSSON_R(crate::FieldReader<bool, bool>);
impl LSECSSON_R {
pub(crate) fn new(bits: bool) -> Self {
LSECSSON_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSECSSON_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSECSSON` writer - LSECSSON"]
pub struct LSECSSON_W<'a> {
w: &'a mut W,
}
impl<'a> LSECSSON_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
self.w
}
}
#[doc = "Field `LSEDRV` reader - SE oscillator drive capability"]
pub struct LSEDRV_R(crate::FieldReader<u8, u8>);
impl LSEDRV_R {
pub(crate) fn new(bits: u8) -> Self {
LSEDRV_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSEDRV_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSEDRV` writer - SE oscillator drive capability"]
pub struct LSEDRV_W<'a> {
w: &'a mut W,
}
impl<'a> LSEDRV_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 3)) | ((value as u32 & 0x03) << 3);
self.w
}
}
#[doc = "Field `LSEBYP` reader - LSE oscillator bypass"]
pub struct LSEBYP_R(crate::FieldReader<bool, bool>);
impl LSEBYP_R {
pub(crate) fn new(bits: bool) -> Self {
LSEBYP_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSEBYP_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSEBYP` writer - LSE oscillator bypass"]
pub struct LSEBYP_W<'a> {
w: &'a mut W,
}
impl<'a> LSEBYP_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
self.w
}
}
#[doc = "Field `LSERDY` reader - LSE oscillator ready"]
pub struct LSERDY_R(crate::FieldReader<bool, bool>);
impl LSERDY_R {
pub(crate) fn new(bits: bool) -> Self {
LSERDY_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSERDY_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSEON` reader - LSE oscillator enable"]
pub struct LSEON_R(crate::FieldReader<bool, bool>);
impl LSEON_R {
pub(crate) fn new(bits: bool) -> Self {
LSEON_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for LSEON_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LSEON` writer - LSE oscillator enable"]
pub struct LSEON_W<'a> {
w: &'a mut W,
}
impl<'a> LSEON_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
self.w
}
}
impl R {
#[doc = "Bit 25 - Low speed clock output selection"]
#[inline(always)]
pub fn lscosel(&self) -> LSCOSEL_R {
LSCOSEL_R::new(((self.bits >> 25) & 0x01) != 0)
}
#[doc = "Bit 24 - Low speed clock output enable"]
#[inline(always)]
pub fn lscoen(&self) -> LSCOEN_R {
LSCOEN_R::new(((self.bits >> 24) & 0x01) != 0)
}
#[doc = "Bit 16 - Backup domain software reset"]
#[inline(always)]
pub fn bdrst(&self) -> BDRST_R {
BDRST_R::new(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 15 - RTC clock enable"]
#[inline(always)]
pub fn rtcen(&self) -> RTCEN_R {
RTCEN_R::new(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bits 8:9 - RTC clock source selection"]
#[inline(always)]
pub fn rtcsel(&self) -> RTCSEL_R {
RTCSEL_R::new(((self.bits >> 8) & 0x03) as u8)
}
#[doc = "Bit 6 - LSECSSD"]
#[inline(always)]
pub fn lsecssd(&self) -> LSECSSD_R {
LSECSSD_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 5 - LSECSSON"]
#[inline(always)]
pub fn lsecsson(&self) -> LSECSSON_R {
LSECSSON_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bits 3:4 - SE oscillator drive capability"]
#[inline(always)]
pub fn lsedrv(&self) -> LSEDRV_R {
LSEDRV_R::new(((self.bits >> 3) & 0x03) as u8)
}
#[doc = "Bit 2 - LSE oscillator bypass"]
#[inline(always)]
pub fn lsebyp(&self) -> LSEBYP_R {
LSEBYP_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - LSE oscillator ready"]
#[inline(always)]
pub fn lserdy(&self) -> LSERDY_R {
LSERDY_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - LSE oscillator enable"]
#[inline(always)]
pub fn lseon(&self) -> LSEON_R {
LSEON_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 25 - Low speed clock output selection"]
#[inline(always)]
pub fn lscosel(&mut self) -> LSCOSEL_W {
LSCOSEL_W { w: self }
}
#[doc = "Bit 24 - Low speed clock output enable"]
#[inline(always)]
pub fn lscoen(&mut self) -> LSCOEN_W {
LSCOEN_W { w: self }
}
#[doc = "Bit 16 - Backup domain software reset"]
#[inline(always)]
pub fn bdrst(&mut self) -> BDRST_W {
BDRST_W { w: self }
}
#[doc = "Bit 15 - RTC clock enable"]
#[inline(always)]
pub fn rtcen(&mut self) -> RTCEN_W {
RTCEN_W { w: self }
}
#[doc = "Bits 8:9 - RTC clock source selection"]
#[inline(always)]
pub fn rtcsel(&mut self) -> RTCSEL_W {
RTCSEL_W { w: self }
}
#[doc = "Bit 5 - LSECSSON"]
#[inline(always)]
pub fn lsecsson(&mut self) -> LSECSSON_W {
LSECSSON_W { w: self }
}
#[doc = "Bits 3:4 - SE oscillator drive capability"]
#[inline(always)]
pub fn lsedrv(&mut self) -> LSEDRV_W {
LSEDRV_W { w: self }
}
#[doc = "Bit 2 - LSE oscillator bypass"]
#[inline(always)]
pub fn lsebyp(&mut self) -> LSEBYP_W {
LSEBYP_W { w: self }
}
#[doc = "Bit 0 - LSE oscillator enable"]
#[inline(always)]
pub fn lseon(&mut self) -> LSEON_W {
LSEON_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "BDCR\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [bdcr](index.html) module"]
pub struct BDCR_SPEC;
impl crate::RegisterSpec for BDCR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [bdcr::R](R) reader structure"]
impl crate::Readable for BDCR_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [bdcr::W](W) writer structure"]
impl crate::Writable for BDCR_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets BDCR to value 0"]
impl crate::Resettable for BDCR_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}