#[doc = "Register `SR` reader"]
pub struct R(crate::R<SR_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<SR_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<SR_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<SR_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `SR` writer"]
pub struct W(crate::W<SR_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<SR_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<SR_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<SR_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Capture/Compare 4 overcapture flag"]
pub use CC1OF_A as CC4OF_A;
#[doc = "Capture/Compare 3 overcapture flag"]
pub use CC1OF_A as CC3OF_A;
#[doc = "Capture/compare 2 overcapture flag"]
pub use CC1OF_A as CC2OF_A;
#[doc = "Capture/Compare 4 overcapture flag"]
pub use CC1OF_AW as CC4OF_AW;
#[doc = "Capture/Compare 3 overcapture flag"]
pub use CC1OF_AW as CC3OF_AW;
#[doc = "Capture/compare 2 overcapture flag"]
pub use CC1OF_AW as CC2OF_AW;
#[doc = "Field `CC4OF` reader - Capture/Compare 4 overcapture flag"]
pub use CC1OF_R as CC4OF_R;
#[doc = "Field `CC3OF` reader - Capture/Compare 3 overcapture flag"]
pub use CC1OF_R as CC3OF_R;
#[doc = "Field `CC2OF` reader - Capture/compare 2 overcapture flag"]
pub use CC1OF_R as CC2OF_R;
#[doc = "Field `CC4OF` writer - Capture/Compare 4 overcapture flag"]
pub use CC1OF_W as CC4OF_W;
#[doc = "Field `CC3OF` writer - Capture/Compare 3 overcapture flag"]
pub use CC1OF_W as CC3OF_W;
#[doc = "Field `CC2OF` writer - Capture/compare 2 overcapture flag"]
pub use CC1OF_W as CC2OF_W;
#[doc = "Capture/Compare 1 overcapture flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CC1OF_A {
#[doc = "1: The counter value has been captured in TIMx_CCRx register while CCxIF flag was already set"]
Overcapture = 1,
}
impl From<CC1OF_A> for bool {
#[inline(always)]
fn from(variant: CC1OF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CC1OF` reader - Capture/Compare 1 overcapture flag"]
pub type CC1OF_R = crate::BitReader<CC1OF_A>;
impl CC1OF_R {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<CC1OF_A> {
match self.bits {
true => Some(CC1OF_A::Overcapture),
_ => None,
}
}
#[doc = "Checks if the value of the field is `Overcapture`"]
#[inline(always)]
pub fn is_overcapture(&self) -> bool {
*self == CC1OF_A::Overcapture
}
}
#[doc = "Capture/Compare 1 overcapture flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CC1OF_AW {
#[doc = "0: Clear flag"]
Clear = 0,
}
impl From<CC1OF_AW> for bool {
#[inline(always)]
fn from(variant: CC1OF_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CC1OF` writer - Capture/Compare 1 overcapture flag"]
pub type CC1OF_W<'a> = crate::BitWriter<'a, u32, SR_SPEC, CC1OF_AW, 9>;
impl<'a> CC1OF_W<'a> {
#[doc = "Clear flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(CC1OF_AW::Clear)
}
}
#[doc = "Trigger interrupt flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TIF_A {
#[doc = "0: No trigger event occurred"]
NoTrigger = 0,
#[doc = "1: Trigger interrupt pending"]
Trigger = 1,
}
impl From<TIF_A> for bool {
#[inline(always)]
fn from(variant: TIF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `TIF` reader - Trigger interrupt flag"]
pub type TIF_R = crate::BitReader<TIF_A>;
impl TIF_R {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TIF_A {
match self.bits {
false => TIF_A::NoTrigger,
true => TIF_A::Trigger,
}
}
#[doc = "Checks if the value of the field is `NoTrigger`"]
#[inline(always)]
pub fn is_no_trigger(&self) -> bool {
*self == TIF_A::NoTrigger
}
#[doc = "Checks if the value of the field is `Trigger`"]
#[inline(always)]
pub fn is_trigger(&self) -> bool {
*self == TIF_A::Trigger
}
}
#[doc = "Trigger interrupt flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TIF_AW {
#[doc = "0: Clear flag"]
Clear = 0,
}
impl From<TIF_AW> for bool {
#[inline(always)]
fn from(variant: TIF_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `TIF` writer - Trigger interrupt flag"]
pub type TIF_W<'a> = crate::BitWriter<'a, u32, SR_SPEC, TIF_AW, 6>;
impl<'a> TIF_W<'a> {
#[doc = "Clear flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(TIF_AW::Clear)
}
}
#[doc = "Capture/Compare 4 interrupt flag"]
pub use CC1IF_A as CC4IF_A;
#[doc = "Capture/Compare 3 interrupt flag"]
pub use CC1IF_A as CC3IF_A;
#[doc = "Capture/Compare 2 interrupt flag"]
pub use CC1IF_A as CC2IF_A;
#[doc = "Capture/Compare 4 interrupt flag"]
pub use CC1IF_AW as CC4IF_AW;
#[doc = "Capture/Compare 3 interrupt flag"]
pub use CC1IF_AW as CC3IF_AW;
#[doc = "Capture/Compare 2 interrupt flag"]
pub use CC1IF_AW as CC2IF_AW;
#[doc = "Field `CC4IF` reader - Capture/Compare 4 interrupt flag"]
pub use CC1IF_R as CC4IF_R;
#[doc = "Field `CC3IF` reader - Capture/Compare 3 interrupt flag"]
pub use CC1IF_R as CC3IF_R;
#[doc = "Field `CC2IF` reader - Capture/Compare 2 interrupt flag"]
pub use CC1IF_R as CC2IF_R;
#[doc = "Field `CC4IF` writer - Capture/Compare 4 interrupt flag"]
pub use CC1IF_W as CC4IF_W;
#[doc = "Field `CC3IF` writer - Capture/Compare 3 interrupt flag"]
pub use CC1IF_W as CC3IF_W;
#[doc = "Field `CC2IF` writer - Capture/Compare 2 interrupt flag"]
pub use CC1IF_W as CC2IF_W;
#[doc = "Capture/compare 1 interrupt flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CC1IF_A {
#[doc = "1: If CC1 is an output: The content of the counter TIMx_CNT matches the content of the TIMx_CCR1 register. If CC1 is an input: The counter value has been captured in TIMx_CCR1 register."]
Match = 1,
}
impl From<CC1IF_A> for bool {
#[inline(always)]
fn from(variant: CC1IF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CC1IF` reader - Capture/compare 1 interrupt flag"]
pub type CC1IF_R = crate::BitReader<CC1IF_A>;
impl CC1IF_R {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<CC1IF_A> {
match self.bits {
true => Some(CC1IF_A::Match),
_ => None,
}
}
#[doc = "Checks if the value of the field is `Match`"]
#[inline(always)]
pub fn is_match(&self) -> bool {
*self == CC1IF_A::Match
}
}
#[doc = "Capture/compare 1 interrupt flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CC1IF_AW {
#[doc = "0: Clear flag"]
Clear = 0,
}
impl From<CC1IF_AW> for bool {
#[inline(always)]
fn from(variant: CC1IF_AW) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `CC1IF` writer - Capture/compare 1 interrupt flag"]
pub type CC1IF_W<'a> = crate::BitWriter<'a, u32, SR_SPEC, CC1IF_AW, 1>;
impl<'a> CC1IF_W<'a> {
#[doc = "Clear flag"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(CC1IF_AW::Clear)
}
}
#[doc = "Update interrupt flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UIF_A {
#[doc = "0: No update occurred"]
Clear = 0,
#[doc = "1: Update interrupt pending."]
UpdatePending = 1,
}
impl From<UIF_A> for bool {
#[inline(always)]
fn from(variant: UIF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `UIF` reader - Update interrupt flag"]
pub type UIF_R = crate::BitReader<UIF_A>;
impl UIF_R {
#[doc = "Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> UIF_A {
match self.bits {
false => UIF_A::Clear,
true => UIF_A::UpdatePending,
}
}
#[doc = "Checks if the value of the field is `Clear`"]
#[inline(always)]
pub fn is_clear(&self) -> bool {
*self == UIF_A::Clear
}
#[doc = "Checks if the value of the field is `UpdatePending`"]
#[inline(always)]
pub fn is_update_pending(&self) -> bool {
*self == UIF_A::UpdatePending
}
}
#[doc = "Field `UIF` writer - Update interrupt flag"]
pub type UIF_W<'a> = crate::BitWriter<'a, u32, SR_SPEC, UIF_A, 0>;
impl<'a> UIF_W<'a> {
#[doc = "No update occurred"]
#[inline(always)]
pub fn clear(self) -> &'a mut W {
self.variant(UIF_A::Clear)
}
#[doc = "Update interrupt pending."]
#[inline(always)]
pub fn update_pending(self) -> &'a mut W {
self.variant(UIF_A::UpdatePending)
}
}
impl R {
#[doc = "Bit 12 - Capture/Compare 4 overcapture flag"]
#[inline(always)]
pub fn cc4of(&self) -> CC4OF_R {
CC4OF_R::new(((self.bits >> 12) & 1) != 0)
}
#[doc = "Bit 11 - Capture/Compare 3 overcapture flag"]
#[inline(always)]
pub fn cc3of(&self) -> CC3OF_R {
CC3OF_R::new(((self.bits >> 11) & 1) != 0)
}
#[doc = "Bit 10 - Capture/compare 2 overcapture flag"]
#[inline(always)]
pub fn cc2of(&self) -> CC2OF_R {
CC2OF_R::new(((self.bits >> 10) & 1) != 0)
}
#[doc = "Bit 9 - Capture/Compare 1 overcapture flag"]
#[inline(always)]
pub fn cc1of(&self) -> CC1OF_R {
CC1OF_R::new(((self.bits >> 9) & 1) != 0)
}
#[doc = "Bit 6 - Trigger interrupt flag"]
#[inline(always)]
pub fn tif(&self) -> TIF_R {
TIF_R::new(((self.bits >> 6) & 1) != 0)
}
#[doc = "Bit 4 - Capture/Compare 4 interrupt flag"]
#[inline(always)]
pub fn cc4if(&self) -> CC4IF_R {
CC4IF_R::new(((self.bits >> 4) & 1) != 0)
}
#[doc = "Bit 3 - Capture/Compare 3 interrupt flag"]
#[inline(always)]
pub fn cc3if(&self) -> CC3IF_R {
CC3IF_R::new(((self.bits >> 3) & 1) != 0)
}
#[doc = "Bit 2 - Capture/Compare 2 interrupt flag"]
#[inline(always)]
pub fn cc2if(&self) -> CC2IF_R {
CC2IF_R::new(((self.bits >> 2) & 1) != 0)
}
#[doc = "Bit 1 - Capture/compare 1 interrupt flag"]
#[inline(always)]
pub fn cc1if(&self) -> CC1IF_R {
CC1IF_R::new(((self.bits >> 1) & 1) != 0)
}
#[doc = "Bit 0 - Update interrupt flag"]
#[inline(always)]
pub fn uif(&self) -> UIF_R {
UIF_R::new((self.bits & 1) != 0)
}
}
impl W {
#[doc = "Bit 12 - Capture/Compare 4 overcapture flag"]
#[inline(always)]
pub fn cc4of(&mut self) -> CC4OF_W {
CC4OF_W::new(self)
}
#[doc = "Bit 11 - Capture/Compare 3 overcapture flag"]
#[inline(always)]
pub fn cc3of(&mut self) -> CC3OF_W {
CC3OF_W::new(self)
}
#[doc = "Bit 10 - Capture/compare 2 overcapture flag"]
#[inline(always)]
pub fn cc2of(&mut self) -> CC2OF_W {
CC2OF_W::new(self)
}
#[doc = "Bit 9 - Capture/Compare 1 overcapture flag"]
#[inline(always)]
pub fn cc1of(&mut self) -> CC1OF_W {
CC1OF_W::new(self)
}
#[doc = "Bit 6 - Trigger interrupt flag"]
#[inline(always)]
pub fn tif(&mut self) -> TIF_W {
TIF_W::new(self)
}
#[doc = "Bit 4 - Capture/Compare 4 interrupt flag"]
#[inline(always)]
pub fn cc4if(&mut self) -> CC4IF_W {
CC4IF_W::new(self)
}
#[doc = "Bit 3 - Capture/Compare 3 interrupt flag"]
#[inline(always)]
pub fn cc3if(&mut self) -> CC3IF_W {
CC3IF_W::new(self)
}
#[doc = "Bit 2 - Capture/Compare 2 interrupt flag"]
#[inline(always)]
pub fn cc2if(&mut self) -> CC2IF_W {
CC2IF_W::new(self)
}
#[doc = "Bit 1 - Capture/compare 1 interrupt flag"]
#[inline(always)]
pub fn cc1if(&mut self) -> CC1IF_W {
CC1IF_W::new(self)
}
#[doc = "Bit 0 - Update interrupt flag"]
#[inline(always)]
pub fn uif(&mut self) -> UIF_W {
UIF_W::new(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 = "status 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 [sr](index.html) module"]
pub struct SR_SPEC;
impl crate::RegisterSpec for SR_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [sr::R](R) reader structure"]
impl crate::Readable for SR_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [sr::W](W) writer structure"]
impl crate::Writable for SR_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets SR to value 0"]
impl crate::Resettable for SR_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}