gd32e2 0.9.1

Device support crate for GD32E2 devices
Documentation
#[doc = "Register `INTF` reader"]
pub type R = crate::R<IntfSpec>;
#[doc = "Channel 0 Global interrupt flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Gif0 {
    #[doc = "0: No transfer error, half event, complete event"]
    NoEvent = 0,
    #[doc = "1: A transfer error, half event or complete event has occured"]
    Event = 1,
}
impl From<Gif0> for bool {
    #[inline(always)]
    fn from(variant: Gif0) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `GIF0` reader - Channel 0 Global interrupt flag"]
pub type Gif0R = crate::BitReader<Gif0>;
impl Gif0R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Gif0 {
        match self.bits {
            false => Gif0::NoEvent,
            true => Gif0::Event,
        }
    }
    #[doc = "No transfer error, half event, complete event"]
    #[inline(always)]
    pub fn is_no_event(&self) -> bool {
        *self == Gif0::NoEvent
    }
    #[doc = "A transfer error, half event or complete event has occured"]
    #[inline(always)]
    pub fn is_event(&self) -> bool {
        *self == Gif0::Event
    }
}
#[doc = "Channel 0 Full Transfer Finish flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Ftfif0 {
    #[doc = "0: No transfer complete event"]
    NotComplete = 0,
    #[doc = "1: A transfer complete event has occured"]
    Complete = 1,
}
impl From<Ftfif0> for bool {
    #[inline(always)]
    fn from(variant: Ftfif0) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `FTFIF0` reader - Channel 0 Full Transfer Finish flag"]
pub type Ftfif0R = crate::BitReader<Ftfif0>;
impl Ftfif0R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Ftfif0 {
        match self.bits {
            false => Ftfif0::NotComplete,
            true => Ftfif0::Complete,
        }
    }
    #[doc = "No transfer complete event"]
    #[inline(always)]
    pub fn is_not_complete(&self) -> bool {
        *self == Ftfif0::NotComplete
    }
    #[doc = "A transfer complete event has occured"]
    #[inline(always)]
    pub fn is_complete(&self) -> bool {
        *self == Ftfif0::Complete
    }
}
#[doc = "Channel 0 Half Transfer Finish flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Htfif0 {
    #[doc = "0: No half transfer event"]
    NotHalf = 0,
    #[doc = "1: A half transfer event has occured"]
    Half = 1,
}
impl From<Htfif0> for bool {
    #[inline(always)]
    fn from(variant: Htfif0) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `HTFIF0` reader - Channel 0 Half Transfer Finish flag"]
pub type Htfif0R = crate::BitReader<Htfif0>;
impl Htfif0R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Htfif0 {
        match self.bits {
            false => Htfif0::NotHalf,
            true => Htfif0::Half,
        }
    }
    #[doc = "No half transfer event"]
    #[inline(always)]
    pub fn is_not_half(&self) -> bool {
        *self == Htfif0::NotHalf
    }
    #[doc = "A half transfer event has occured"]
    #[inline(always)]
    pub fn is_half(&self) -> bool {
        *self == Htfif0::Half
    }
}
#[doc = "Channel 0 Error flag\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Errif0 {
    #[doc = "0: No transfer error"]
    NoError = 0,
    #[doc = "1: A transfer error has occured"]
    Error = 1,
}
impl From<Errif0> for bool {
    #[inline(always)]
    fn from(variant: Errif0) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ERRIF0` reader - Channel 0 Error flag"]
pub type Errif0R = crate::BitReader<Errif0>;
impl Errif0R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Errif0 {
        match self.bits {
            false => Errif0::NoError,
            true => Errif0::Error,
        }
    }
    #[doc = "No transfer error"]
    #[inline(always)]
    pub fn is_no_error(&self) -> bool {
        *self == Errif0::NoError
    }
    #[doc = "A transfer error has occured"]
    #[inline(always)]
    pub fn is_error(&self) -> bool {
        *self == Errif0::Error
    }
}
#[doc = "Field `ERRIF1` reader - Channel 1 Error flag"]
pub use Errif0R as Errif1R;
#[doc = "Field `ERRIF2` reader - Channel 2 Error flag"]
pub use Errif0R as Errif2R;
#[doc = "Field `ERRIF3` reader - Channel 3 Error flag"]
pub use Errif0R as Errif3R;
#[doc = "Field `ERRIF4` reader - Channel 4 Error flag"]
pub use Errif0R as Errif4R;
#[doc = "Field `FTFIF1` reader - Channel 1 Full Transfer Finish flag"]
pub use Ftfif0R as Ftfif1R;
#[doc = "Field `FTFIF2` reader - Channel 2 Full Transfer Finish flag"]
pub use Ftfif0R as Ftfif2R;
#[doc = "Field `FTFIF3` reader - Channel 3 Full Transfer Finish flag"]
pub use Ftfif0R as Ftfif3R;
#[doc = "Field `FTFIF4` reader - Channel 4 Full Transfer Finish flag"]
pub use Ftfif0R as Ftfif4R;
#[doc = "Field `GIF1` reader - Channel 1 Global interrupt flag"]
pub use Gif0R as Gif1R;
#[doc = "Field `GIF2` reader - Channel 2 Global interrupt flag"]
pub use Gif0R as Gif2R;
#[doc = "Field `GIF3` reader - Channel 3 Global interrupt flag"]
pub use Gif0R as Gif3R;
#[doc = "Field `GIF4` reader - Channel 4 Global interrupt flag"]
pub use Gif0R as Gif4R;
#[doc = "Field `HTFIF1` reader - Channel 1 Half Transfer Finish flag"]
pub use Htfif0R as Htfif1R;
#[doc = "Field `HTFIF2` reader - Channel 2 Half Transfer Finish flag"]
pub use Htfif0R as Htfif2R;
#[doc = "Field `HTFIF3` reader - Channel 3 Half Transfer Finish flag"]
pub use Htfif0R as Htfif3R;
#[doc = "Field `HTFIF4` reader - Channel 4 Half Transfer Finish flag"]
pub use Htfif0R as Htfif4R;
impl R {
    #[doc = "Bit 0 - Channel 0 Global interrupt flag"]
    #[inline(always)]
    pub fn gif0(&self) -> Gif0R {
        Gif0R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Channel 0 Full Transfer Finish flag"]
    #[inline(always)]
    pub fn ftfif0(&self) -> Ftfif0R {
        Ftfif0R::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - Channel 0 Half Transfer Finish flag"]
    #[inline(always)]
    pub fn htfif0(&self) -> Htfif0R {
        Htfif0R::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Channel 0 Error flag"]
    #[inline(always)]
    pub fn errif0(&self) -> Errif0R {
        Errif0R::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bit 4 - Channel 1 Global interrupt flag"]
    #[inline(always)]
    pub fn gif1(&self) -> Gif1R {
        Gif1R::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bit 5 - Channel 1 Full Transfer Finish flag"]
    #[inline(always)]
    pub fn ftfif1(&self) -> Ftfif1R {
        Ftfif1R::new(((self.bits >> 5) & 1) != 0)
    }
    #[doc = "Bit 6 - Channel 1 Half Transfer Finish flag"]
    #[inline(always)]
    pub fn htfif1(&self) -> Htfif1R {
        Htfif1R::new(((self.bits >> 6) & 1) != 0)
    }
    #[doc = "Bit 7 - Channel 1 Error flag"]
    #[inline(always)]
    pub fn errif1(&self) -> Errif1R {
        Errif1R::new(((self.bits >> 7) & 1) != 0)
    }
    #[doc = "Bit 8 - Channel 2 Global interrupt flag"]
    #[inline(always)]
    pub fn gif2(&self) -> Gif2R {
        Gif2R::new(((self.bits >> 8) & 1) != 0)
    }
    #[doc = "Bit 9 - Channel 2 Full Transfer Finish flag"]
    #[inline(always)]
    pub fn ftfif2(&self) -> Ftfif2R {
        Ftfif2R::new(((self.bits >> 9) & 1) != 0)
    }
    #[doc = "Bit 10 - Channel 2 Half Transfer Finish flag"]
    #[inline(always)]
    pub fn htfif2(&self) -> Htfif2R {
        Htfif2R::new(((self.bits >> 10) & 1) != 0)
    }
    #[doc = "Bit 11 - Channel 2 Error flag"]
    #[inline(always)]
    pub fn errif2(&self) -> Errif2R {
        Errif2R::new(((self.bits >> 11) & 1) != 0)
    }
    #[doc = "Bit 12 - Channel 3 Global interrupt flag"]
    #[inline(always)]
    pub fn gif3(&self) -> Gif3R {
        Gif3R::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bit 13 - Channel 3 Full Transfer Finish flag"]
    #[inline(always)]
    pub fn ftfif3(&self) -> Ftfif3R {
        Ftfif3R::new(((self.bits >> 13) & 1) != 0)
    }
    #[doc = "Bit 14 - Channel 3 Half Transfer Finish flag"]
    #[inline(always)]
    pub fn htfif3(&self) -> Htfif3R {
        Htfif3R::new(((self.bits >> 14) & 1) != 0)
    }
    #[doc = "Bit 15 - Channel 3 Error flag"]
    #[inline(always)]
    pub fn errif3(&self) -> Errif3R {
        Errif3R::new(((self.bits >> 15) & 1) != 0)
    }
    #[doc = "Bit 16 - Channel 4 Global interrupt flag"]
    #[inline(always)]
    pub fn gif4(&self) -> Gif4R {
        Gif4R::new(((self.bits >> 16) & 1) != 0)
    }
    #[doc = "Bit 17 - Channel 4 Full Transfer Finish flag"]
    #[inline(always)]
    pub fn ftfif4(&self) -> Ftfif4R {
        Ftfif4R::new(((self.bits >> 17) & 1) != 0)
    }
    #[doc = "Bit 18 - Channel 4 Half Transfer Finish flag"]
    #[inline(always)]
    pub fn htfif4(&self) -> Htfif4R {
        Htfif4R::new(((self.bits >> 18) & 1) != 0)
    }
    #[doc = "Bit 19 - Channel 4 Error flag"]
    #[inline(always)]
    pub fn errif4(&self) -> Errif4R {
        Errif4R::new(((self.bits >> 19) & 1) != 0)
    }
}
#[doc = "DMA interrupt flag register (DMA_INTF)\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`intf::R`](R).  See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct IntfSpec;
impl crate::RegisterSpec for IntfSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`intf::R`](R) reader structure"]
impl crate::Readable for IntfSpec {}
#[doc = "`reset()` method sets INTF to value 0"]
impl crate::Resettable for IntfSpec {
    const RESET_VALUE: u32 = 0;
}