#[doc = "Register `AHB1RSTR` reader"]
pub struct R(crate::R<AHB1RSTR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<AHB1RSTR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<AHB1RSTR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<AHB1RSTR_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `AHB1RSTR` writer"]
pub struct W(crate::W<AHB1RSTR_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<AHB1RSTR_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<AHB1RSTR_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<AHB1RSTR_SPEC>) -> Self {
W(writer)
}
}
#[doc = "IO port A reset\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum GPIOARST_A {
#[doc = "1: Reset the selected module"]
RESET = 1,
}
impl From<GPIOARST_A> for bool {
#[inline(always)]
fn from(variant: GPIOARST_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `GPIOARST` reader - IO port A reset"]
pub struct GPIOARST_R(crate::FieldReader<bool, GPIOARST_A>);
impl GPIOARST_R {
pub(crate) fn new(bits: bool) -> Self {
GPIOARST_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<GPIOARST_A> {
match self.bits {
true => Some(GPIOARST_A::RESET),
_ => None,
}
}
#[doc = "Checks if the value of the field is `RESET`"]
#[inline(always)]
pub fn is_reset(&self) -> bool {
**self == GPIOARST_A::RESET
}
}
impl core::ops::Deref for GPIOARST_R {
type Target = crate::FieldReader<bool, GPIOARST_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `GPIOARST` writer - IO port A reset"]
pub struct GPIOARST_W<'a> {
w: &'a mut W,
}
impl<'a> GPIOARST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GPIOARST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(GPIOARST_A::RESET)
}
#[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
}
}
#[doc = "IO port B reset"]
pub type GPIOBRST_A = GPIOARST_A;
#[doc = "Field `GPIOBRST` reader - IO port B reset"]
pub type GPIOBRST_R = GPIOARST_R;
#[doc = "Field `GPIOBRST` writer - IO port B reset"]
pub struct GPIOBRST_W<'a> {
w: &'a mut W,
}
impl<'a> GPIOBRST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GPIOBRST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(GPIOBRST_A::RESET)
}
#[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 = "IO port C reset"]
pub type GPIOCRST_A = GPIOARST_A;
#[doc = "Field `GPIOCRST` reader - IO port C reset"]
pub type GPIOCRST_R = GPIOARST_R;
#[doc = "Field `GPIOCRST` writer - IO port C reset"]
pub struct GPIOCRST_W<'a> {
w: &'a mut W,
}
impl<'a> GPIOCRST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GPIOCRST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(GPIOCRST_A::RESET)
}
#[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 = "IO port D reset"]
pub type GPIODRST_A = GPIOARST_A;
#[doc = "Field `GPIODRST` reader - IO port D reset"]
pub type GPIODRST_R = GPIOARST_R;
#[doc = "Field `GPIODRST` writer - IO port D reset"]
pub struct GPIODRST_W<'a> {
w: &'a mut W,
}
impl<'a> GPIODRST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GPIODRST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(GPIODRST_A::RESET)
}
#[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 = "IO port E reset"]
pub type GPIOERST_A = GPIOARST_A;
#[doc = "Field `GPIOERST` reader - IO port E reset"]
pub type GPIOERST_R = GPIOARST_R;
#[doc = "Field `GPIOERST` writer - IO port E reset"]
pub struct GPIOERST_W<'a> {
w: &'a mut W,
}
impl<'a> GPIOERST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GPIOERST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(GPIOERST_A::RESET)
}
#[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 = "IO port F reset"]
pub type GPIOFRST_A = GPIOARST_A;
#[doc = "Field `GPIOFRST` reader - IO port F reset"]
pub type GPIOFRST_R = GPIOARST_R;
#[doc = "Field `GPIOFRST` writer - IO port F reset"]
pub struct GPIOFRST_W<'a> {
w: &'a mut W,
}
impl<'a> GPIOFRST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GPIOFRST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(GPIOFRST_A::RESET)
}
#[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 = "IO port G reset"]
pub type GPIOGRST_A = GPIOARST_A;
#[doc = "Field `GPIOGRST` reader - IO port G reset"]
pub type GPIOGRST_R = GPIOARST_R;
#[doc = "Field `GPIOGRST` writer - IO port G reset"]
pub struct GPIOGRST_W<'a> {
w: &'a mut W,
}
impl<'a> GPIOGRST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GPIOGRST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(GPIOGRST_A::RESET)
}
#[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 << 6)) | ((value as u32 & 0x01) << 6);
self.w
}
}
#[doc = "IO port H reset"]
pub type GPIOHRST_A = GPIOARST_A;
#[doc = "Field `GPIOHRST` reader - IO port H reset"]
pub type GPIOHRST_R = GPIOARST_R;
#[doc = "Field `GPIOHRST` writer - IO port H reset"]
pub struct GPIOHRST_W<'a> {
w: &'a mut W,
}
impl<'a> GPIOHRST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: GPIOHRST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(GPIOHRST_A::RESET)
}
#[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 << 7)) | ((value as u32 & 0x01) << 7);
self.w
}
}
#[doc = "CRC reset"]
pub type CRCRST_A = GPIOARST_A;
#[doc = "Field `CRCRST` reader - CRC reset"]
pub type CRCRST_R = GPIOARST_R;
#[doc = "Field `CRCRST` writer - CRC reset"]
pub struct CRCRST_W<'a> {
w: &'a mut W,
}
impl<'a> CRCRST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CRCRST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(CRCRST_A::RESET)
}
#[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 << 12)) | ((value as u32 & 0x01) << 12);
self.w
}
}
#[doc = "DMA2 reset"]
pub type DMA1RST_A = GPIOARST_A;
#[doc = "Field `DMA1RST` reader - DMA2 reset"]
pub type DMA1RST_R = GPIOARST_R;
#[doc = "Field `DMA1RST` writer - DMA2 reset"]
pub struct DMA1RST_W<'a> {
w: &'a mut W,
}
impl<'a> DMA1RST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: DMA1RST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(DMA1RST_A::RESET)
}
#[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 << 21)) | ((value as u32 & 0x01) << 21);
self.w
}
}
#[doc = "DMA2 reset"]
pub type DMA2RST_A = GPIOARST_A;
#[doc = "Field `DMA2RST` reader - DMA2 reset"]
pub type DMA2RST_R = GPIOARST_R;
#[doc = "Field `DMA2RST` writer - DMA2 reset"]
pub struct DMA2RST_W<'a> {
w: &'a mut W,
}
impl<'a> DMA2RST_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: DMA2RST_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Reset the selected module"]
#[inline(always)]
pub fn reset(self) -> &'a mut W {
self.variant(DMA2RST_A::RESET)
}
#[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 << 22)) | ((value as u32 & 0x01) << 22);
self.w
}
}
impl R {
#[doc = "Bit 0 - IO port A reset"]
#[inline(always)]
pub fn gpioarst(&self) -> GPIOARST_R {
GPIOARST_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - IO port B reset"]
#[inline(always)]
pub fn gpiobrst(&self) -> GPIOBRST_R {
GPIOBRST_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - IO port C reset"]
#[inline(always)]
pub fn gpiocrst(&self) -> GPIOCRST_R {
GPIOCRST_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - IO port D reset"]
#[inline(always)]
pub fn gpiodrst(&self) -> GPIODRST_R {
GPIODRST_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - IO port E reset"]
#[inline(always)]
pub fn gpioerst(&self) -> GPIOERST_R {
GPIOERST_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - IO port F reset"]
#[inline(always)]
pub fn gpiofrst(&self) -> GPIOFRST_R {
GPIOFRST_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - IO port G reset"]
#[inline(always)]
pub fn gpiogrst(&self) -> GPIOGRST_R {
GPIOGRST_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 7 - IO port H reset"]
#[inline(always)]
pub fn gpiohrst(&self) -> GPIOHRST_R {
GPIOHRST_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 12 - CRC reset"]
#[inline(always)]
pub fn crcrst(&self) -> CRCRST_R {
CRCRST_R::new(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bit 21 - DMA2 reset"]
#[inline(always)]
pub fn dma1rst(&self) -> DMA1RST_R {
DMA1RST_R::new(((self.bits >> 21) & 0x01) != 0)
}
#[doc = "Bit 22 - DMA2 reset"]
#[inline(always)]
pub fn dma2rst(&self) -> DMA2RST_R {
DMA2RST_R::new(((self.bits >> 22) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - IO port A reset"]
#[inline(always)]
pub fn gpioarst(&mut self) -> GPIOARST_W {
GPIOARST_W { w: self }
}
#[doc = "Bit 1 - IO port B reset"]
#[inline(always)]
pub fn gpiobrst(&mut self) -> GPIOBRST_W {
GPIOBRST_W { w: self }
}
#[doc = "Bit 2 - IO port C reset"]
#[inline(always)]
pub fn gpiocrst(&mut self) -> GPIOCRST_W {
GPIOCRST_W { w: self }
}
#[doc = "Bit 3 - IO port D reset"]
#[inline(always)]
pub fn gpiodrst(&mut self) -> GPIODRST_W {
GPIODRST_W { w: self }
}
#[doc = "Bit 4 - IO port E reset"]
#[inline(always)]
pub fn gpioerst(&mut self) -> GPIOERST_W {
GPIOERST_W { w: self }
}
#[doc = "Bit 5 - IO port F reset"]
#[inline(always)]
pub fn gpiofrst(&mut self) -> GPIOFRST_W {
GPIOFRST_W { w: self }
}
#[doc = "Bit 6 - IO port G reset"]
#[inline(always)]
pub fn gpiogrst(&mut self) -> GPIOGRST_W {
GPIOGRST_W { w: self }
}
#[doc = "Bit 7 - IO port H reset"]
#[inline(always)]
pub fn gpiohrst(&mut self) -> GPIOHRST_W {
GPIOHRST_W { w: self }
}
#[doc = "Bit 12 - CRC reset"]
#[inline(always)]
pub fn crcrst(&mut self) -> CRCRST_W {
CRCRST_W { w: self }
}
#[doc = "Bit 21 - DMA2 reset"]
#[inline(always)]
pub fn dma1rst(&mut self) -> DMA1RST_W {
DMA1RST_W { w: self }
}
#[doc = "Bit 22 - DMA2 reset"]
#[inline(always)]
pub fn dma2rst(&mut self) -> DMA2RST_W {
DMA2RST_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 = "AHB1 peripheral reset register\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 [ahb1rstr](index.html) module"]
pub struct AHB1RSTR_SPEC;
impl crate::RegisterSpec for AHB1RSTR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [ahb1rstr::R](R) reader structure"]
impl crate::Readable for AHB1RSTR_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [ahb1rstr::W](W) writer structure"]
impl crate::Writable for AHB1RSTR_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets AHB1RSTR to value 0"]
impl crate::Resettable for AHB1RSTR_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}