esp32 0.6.0

Peripheral access crate for the ESP32
Documentation
#[doc = "Reader of register PERI_CLK_EN"]
pub type R = crate::R<u32, super::PERI_CLK_EN>;
#[doc = "Writer for register PERI_CLK_EN"]
pub type W = crate::W<u32, super::PERI_CLK_EN>;
#[doc = "Register PERI_CLK_EN `reset()`'s with value 0"]
impl crate::ResetValue for super::PERI_CLK_EN {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
#[doc = "Reader of field `PERI_CLK_EN`"]
pub type PERI_CLK_EN_R = crate::R<u32, u32>;
#[doc = "Write proxy for field `PERI_CLK_EN`"]
pub struct PERI_CLK_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> PERI_CLK_EN_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u32) -> &'a mut W {
        self.w.bits = (self.w.bits & !0xffff_ffff) | ((value as u32) & 0xffff_ffff);
        self.w
    }
}
#[doc = "Reader of field `DIGITAL_SIGNATURE`"]
pub type DIGITAL_SIGNATURE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DIGITAL_SIGNATURE`"]
pub struct DIGITAL_SIGNATURE_W<'a> {
    w: &'a mut W,
}
impl<'a> DIGITAL_SIGNATURE_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 << 4)) | (((value as u32) & 0x01) << 4);
        self.w
    }
}
#[doc = "Reader of field `SECURE_BOOT`"]
pub type SECURE_BOOT_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SECURE_BOOT`"]
pub struct SECURE_BOOT_W<'a> {
    w: &'a mut W,
}
impl<'a> SECURE_BOOT_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 u32) & 0x01) << 3);
        self.w
    }
}
#[doc = "Reader of field `RSA_ACCELERATOR`"]
pub type RSA_ACCELERATOR_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `RSA_ACCELERATOR`"]
pub struct RSA_ACCELERATOR_W<'a> {
    w: &'a mut W,
}
impl<'a> RSA_ACCELERATOR_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 = "Reader of field `SHA_ACCELERATOR`"]
pub type SHA_ACCELERATOR_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SHA_ACCELERATOR`"]
pub struct SHA_ACCELERATOR_W<'a> {
    w: &'a mut W,
}
impl<'a> SHA_ACCELERATOR_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 << 1)) | (((value as u32) & 0x01) << 1);
        self.w
    }
}
#[doc = "Reader of field `AES_ACCELERATOR`"]
pub type AES_ACCELERATOR_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `AES_ACCELERATOR`"]
pub struct AES_ACCELERATOR_W<'a> {
    w: &'a mut W,
}
impl<'a> AES_ACCELERATOR_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 = "Bits 0:31"]
    #[inline(always)]
    pub fn peri_clk_en(&self) -> PERI_CLK_EN_R {
        PERI_CLK_EN_R::new((self.bits & 0xffff_ffff) as u32)
    }
    #[doc = "Bit 4"]
    #[inline(always)]
    pub fn digital_signature(&self) -> DIGITAL_SIGNATURE_R {
        DIGITAL_SIGNATURE_R::new(((self.bits >> 4) & 0x01) != 0)
    }
    #[doc = "Bit 3"]
    #[inline(always)]
    pub fn secure_boot(&self) -> SECURE_BOOT_R {
        SECURE_BOOT_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bit 2"]
    #[inline(always)]
    pub fn rsa_accelerator(&self) -> RSA_ACCELERATOR_R {
        RSA_ACCELERATOR_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 1"]
    #[inline(always)]
    pub fn sha_accelerator(&self) -> SHA_ACCELERATOR_R {
        SHA_ACCELERATOR_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 0"]
    #[inline(always)]
    pub fn aes_accelerator(&self) -> AES_ACCELERATOR_R {
        AES_ACCELERATOR_R::new((self.bits & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:31"]
    #[inline(always)]
    pub fn peri_clk_en(&mut self) -> PERI_CLK_EN_W {
        PERI_CLK_EN_W { w: self }
    }
    #[doc = "Bit 4"]
    #[inline(always)]
    pub fn digital_signature(&mut self) -> DIGITAL_SIGNATURE_W {
        DIGITAL_SIGNATURE_W { w: self }
    }
    #[doc = "Bit 3"]
    #[inline(always)]
    pub fn secure_boot(&mut self) -> SECURE_BOOT_W {
        SECURE_BOOT_W { w: self }
    }
    #[doc = "Bit 2"]
    #[inline(always)]
    pub fn rsa_accelerator(&mut self) -> RSA_ACCELERATOR_W {
        RSA_ACCELERATOR_W { w: self }
    }
    #[doc = "Bit 1"]
    #[inline(always)]
    pub fn sha_accelerator(&mut self) -> SHA_ACCELERATOR_W {
        SHA_ACCELERATOR_W { w: self }
    }
    #[doc = "Bit 0"]
    #[inline(always)]
    pub fn aes_accelerator(&mut self) -> AES_ACCELERATOR_W {
        AES_ACCELERATOR_W { w: self }
    }
}