rust-embedded-talk/example-source/msp432p401r/src/comp_e0/cex_iv.rs

89 lines
2.4 KiB
Rust

#[doc = r" Value read from the register"]
pub struct R {
bits: u16,
}
impl super::CEXIV {
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
}
#[doc = "Possible values of the field `CEIV`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CEIVR {
#[doc = "No interrupt pending"]
CEIV_0,
#[doc = "Interrupt Source: CEOUT interrupt; Interrupt Flag: CEIFG; Interrupt Priority: Highest"]
CEIV_2,
#[doc = "Interrupt Source: CEOUT interrupt inverted polarity; Interrupt Flag: CEIIFG"]
CEIV_4,
#[doc = "Interrupt Source: Comparator ready interrupt; Interrupt Flag: CERDYIFG; Interrupt Priority: Lowest"]
CEIV_10,
#[doc = r" Reserved"]
_Reserved(u16),
}
impl CEIVR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u16 {
match *self {
CEIVR::CEIV_0 => 0,
CEIVR::CEIV_2 => 2,
CEIVR::CEIV_4 => 4,
CEIVR::CEIV_10 => 10,
CEIVR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u16) -> CEIVR {
match value {
0 => CEIVR::CEIV_0,
2 => CEIVR::CEIV_2,
4 => CEIVR::CEIV_4,
10 => CEIVR::CEIV_10,
i => CEIVR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `CEIV_0`"]
#[inline]
pub fn is_ceiv_0(&self) -> bool {
*self == CEIVR::CEIV_0
}
#[doc = "Checks if the value of the field is `CEIV_2`"]
#[inline]
pub fn is_ceiv_2(&self) -> bool {
*self == CEIVR::CEIV_2
}
#[doc = "Checks if the value of the field is `CEIV_4`"]
#[inline]
pub fn is_ceiv_4(&self) -> bool {
*self == CEIVR::CEIV_4
}
#[doc = "Checks if the value of the field is `CEIV_10`"]
#[inline]
pub fn is_ceiv_10(&self) -> bool {
*self == CEIVR::CEIV_10
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u16 {
self.bits
}
#[doc = "Bits 0:15 - Comparator interrupt vector word register"]
#[inline]
pub fn ceiv(&self) -> CEIVR {
CEIVR::_from({
const MASK: u16 = 65535;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u16) as u16
})
}
}