avr-device 0.2.3

Register access crate for AVR microcontrollers
Documentation
#[doc = "Register `CLKSEL0` reader"]
pub struct R(crate::R<CLKSEL0_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CLKSEL0_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CLKSEL0_SPEC>> for R {
    fn from(reader: crate::R<CLKSEL0_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CLKSEL0` writer"]
pub struct W(crate::W<CLKSEL0_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CLKSEL0_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 core::convert::From<crate::W<CLKSEL0_SPEC>> for W {
    fn from(writer: crate::W<CLKSEL0_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `CLKS` reader - <TBD>"]
pub struct CLKS_R(crate::FieldReader<bool, bool>);
impl CLKS_R {
    pub(crate) fn new(bits: bool) -> Self {
        CLKS_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for CLKS_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CLKS` writer - <TBD>"]
pub struct CLKS_W<'a> {
    w: &'a mut W,
}
impl<'a> CLKS_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 u8) & 0x01);
        self.w
    }
}
#[doc = "Field `EXTE` reader - <TBD>"]
pub struct EXTE_R(crate::FieldReader<bool, bool>);
impl EXTE_R {
    pub(crate) fn new(bits: bool) -> Self {
        EXTE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for EXTE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `EXTE` writer - <TBD>"]
pub struct EXTE_W<'a> {
    w: &'a mut W,
}
impl<'a> EXTE_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 u8) & 0x01) << 2);
        self.w
    }
}
#[doc = "Field `RCE` reader - <TBD>"]
pub struct RCE_R(crate::FieldReader<bool, bool>);
impl RCE_R {
    pub(crate) fn new(bits: bool) -> Self {
        RCE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for RCE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RCE` writer - <TBD>"]
pub struct RCE_W<'a> {
    w: &'a mut W,
}
impl<'a> RCE_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 << 3)) | (((value as u8) & 0x01) << 3);
        self.w
    }
}
#[doc = "Field `EXSUT` reader - <TBD>"]
pub struct EXSUT_R(crate::FieldReader<u8, u8>);
impl EXSUT_R {
    pub(crate) fn new(bits: u8) -> Self {
        EXSUT_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for EXSUT_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `EXSUT` writer - <TBD>"]
pub struct EXSUT_W<'a> {
    w: &'a mut W,
}
impl<'a> EXSUT_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u8) & 0x03) << 4);
        self.w
    }
}
#[doc = "Field `RCSUT` reader - <TBD>"]
pub struct RCSUT_R(crate::FieldReader<u8, u8>);
impl RCSUT_R {
    pub(crate) fn new(bits: u8) -> Self {
        RCSUT_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for RCSUT_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RCSUT` writer - <TBD>"]
pub struct RCSUT_W<'a> {
    w: &'a mut W,
}
impl<'a> RCSUT_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u8) & 0x03) << 6);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - <TBD>"]
    #[inline(always)]
    pub fn clks(&self) -> CLKS_R {
        CLKS_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 2 - <TBD>"]
    #[inline(always)]
    pub fn exte(&self) -> EXTE_R {
        EXTE_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 3 - <TBD>"]
    #[inline(always)]
    pub fn rce(&self) -> RCE_R {
        RCE_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bits 4:5 - <TBD>"]
    #[inline(always)]
    pub fn exsut(&self) -> EXSUT_R {
        EXSUT_R::new(((self.bits >> 4) & 0x03) as u8)
    }
    #[doc = "Bits 6:7 - <TBD>"]
    #[inline(always)]
    pub fn rcsut(&self) -> RCSUT_R {
        RCSUT_R::new(((self.bits >> 6) & 0x03) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - <TBD>"]
    #[inline(always)]
    pub fn clks(&mut self) -> CLKS_W {
        CLKS_W { w: self }
    }
    #[doc = "Bit 2 - <TBD>"]
    #[inline(always)]
    pub fn exte(&mut self) -> EXTE_W {
        EXTE_W { w: self }
    }
    #[doc = "Bit 3 - <TBD>"]
    #[inline(always)]
    pub fn rce(&mut self) -> RCE_W {
        RCE_W { w: self }
    }
    #[doc = "Bits 4:5 - <TBD>"]
    #[inline(always)]
    pub fn exsut(&mut self) -> EXSUT_W {
        EXSUT_W { w: self }
    }
    #[doc = "Bits 6:7 - <TBD>"]
    #[inline(always)]
    pub fn rcsut(&mut self) -> RCSUT_W {
        RCSUT_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "<TBD>\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 [clksel0](index.html) module"]
pub struct CLKSEL0_SPEC;
impl crate::RegisterSpec for CLKSEL0_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [clksel0::R](R) reader structure"]
impl crate::Readable for CLKSEL0_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [clksel0::W](W) writer structure"]
impl crate::Writable for CLKSEL0_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CLKSEL0 to value 0"]
impl crate::Resettable for CLKSEL0_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}