msp432-pac/src/dio/p1iv.rs

134 lines
3.8 KiB
Rust

#[doc = r" Value read from the register"]
pub struct R {
bits: u16,
}
impl super::P1IV {
#[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 `P1IV`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum P1IVR {
#[doc = "No interrupt pending"]
P1IV_0,
#[doc = "Interrupt Source: Port 1.0 interrupt; Interrupt Flag: P1IFG0; Interrupt Priority: Highest"]
P1IV_2,
#[doc = "Interrupt Source: Port 1.1 interrupt; Interrupt Flag: P1IFG1"]
P1IV_4,
#[doc = "Interrupt Source: Port 1.2 interrupt; Interrupt Flag: P1IFG2"]
P1IV_6,
#[doc = "Interrupt Source: Port 1.3 interrupt; Interrupt Flag: P1IFG3"]
P1IV_8,
#[doc = "Interrupt Source: Port 1.4 interrupt; Interrupt Flag: P1IFG4"]
P1IV_10,
#[doc = "Interrupt Source: Port 1.5 interrupt; Interrupt Flag: P1IFG5"]
P1IV_12,
#[doc = "Interrupt Source: Port 1.6 interrupt; Interrupt Flag: P1IFG6"]
P1IV_14,
#[doc = "Interrupt Source: Port 1.7 interrupt; Interrupt Flag: P1IFG7; Interrupt Priority: Lowest"]
P1IV_16,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl P1IVR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
P1IVR::P1IV_0 => 0,
P1IVR::P1IV_2 => 2,
P1IVR::P1IV_4 => 4,
P1IVR::P1IV_6 => 6,
P1IVR::P1IV_8 => 8,
P1IVR::P1IV_10 => 10,
P1IVR::P1IV_12 => 12,
P1IVR::P1IV_14 => 14,
P1IVR::P1IV_16 => 16,
P1IVR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: u8) -> P1IVR {
match value {
0 => P1IVR::P1IV_0,
2 => P1IVR::P1IV_2,
4 => P1IVR::P1IV_4,
6 => P1IVR::P1IV_6,
8 => P1IVR::P1IV_8,
10 => P1IVR::P1IV_10,
12 => P1IVR::P1IV_12,
14 => P1IVR::P1IV_14,
16 => P1IVR::P1IV_16,
i => P1IVR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `P1IV_0`"]
#[inline]
pub fn is_p1iv_0(&self) -> bool {
*self == P1IVR::P1IV_0
}
#[doc = "Checks if the value of the field is `P1IV_2`"]
#[inline]
pub fn is_p1iv_2(&self) -> bool {
*self == P1IVR::P1IV_2
}
#[doc = "Checks if the value of the field is `P1IV_4`"]
#[inline]
pub fn is_p1iv_4(&self) -> bool {
*self == P1IVR::P1IV_4
}
#[doc = "Checks if the value of the field is `P1IV_6`"]
#[inline]
pub fn is_p1iv_6(&self) -> bool {
*self == P1IVR::P1IV_6
}
#[doc = "Checks if the value of the field is `P1IV_8`"]
#[inline]
pub fn is_p1iv_8(&self) -> bool {
*self == P1IVR::P1IV_8
}
#[doc = "Checks if the value of the field is `P1IV_10`"]
#[inline]
pub fn is_p1iv_10(&self) -> bool {
*self == P1IVR::P1IV_10
}
#[doc = "Checks if the value of the field is `P1IV_12`"]
#[inline]
pub fn is_p1iv_12(&self) -> bool {
*self == P1IVR::P1IV_12
}
#[doc = "Checks if the value of the field is `P1IV_14`"]
#[inline]
pub fn is_p1iv_14(&self) -> bool {
*self == P1IVR::P1IV_14
}
#[doc = "Checks if the value of the field is `P1IV_16`"]
#[inline]
pub fn is_p1iv_16(&self) -> bool {
*self == P1IVR::P1IV_16
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u16 {
self.bits
}
#[doc = "Bits 0:4 - Port 1 interrupt vector value"]
#[inline]
pub fn p1iv(&self) -> P1IVR {
P1IVR::_from({
const MASK: u8 = 31;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u16) as u8
})
}
}