s32k118.rs/src/can1/wmb1_cs/mod.rs

181 lines
4.3 KiB
Rust

#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
impl super::WMB1_CS {
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
}
#[doc = r" Value of the field"]
pub struct DLCR {
bits: u8,
}
impl DLCR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = "Possible values of the field `RTR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RTRR {
#[doc = "Frame is data one (not remote)"] _0,
#[doc = "Frame is a remote one"] _1,
}
impl RTRR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
RTRR::_0 => false,
RTRR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> RTRR {
match value {
false => RTRR::_0,
true => RTRR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == RTRR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == RTRR::_1
}
}
#[doc = "Possible values of the field `IDE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum IDER {
#[doc = "Frame format is standard"] _0,
#[doc = "Frame format is extended"] _1,
}
impl IDER {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
IDER::_0 => false,
IDER::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> IDER {
match value {
false => IDER::_0,
true => IDER::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == IDER::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == IDER::_1
}
}
#[doc = r" Value of the field"]
pub struct SRRR {
bits: bool,
}
impl SRRR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
self.bits
}
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 16:19 - Length of Data in Bytes"]
#[inline]
pub fn dlc(&self) -> DLCR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 16;
((self.bits >> OFFSET) & MASK as u32) as u8
};
DLCR { bits }
}
#[doc = "Bit 20 - Remote Transmission Request Bit"]
#[inline]
pub fn rtr(&self) -> RTRR {
RTRR::_from({
const MASK: bool = true;
const OFFSET: u8 = 20;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 21 - ID Extended Bit"]
#[inline]
pub fn ide(&self) -> IDER {
IDER::_from({
const MASK: bool = true;
const OFFSET: u8 = 21;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 22 - Substitute Remote Request"]
#[inline]
pub fn srr(&self) -> SRRR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 22;
((self.bits >> OFFSET) & MASK as u32) != 0
};
SRRR { bits }
}
}