#[doc = "Reader of register IF2MCTL"]
pub type R = crate::R<u32, super::IF2MCTL>;
#[doc = "Writer for register IF2MCTL"]
pub type W = crate::W<u32, super::IF2MCTL>;
#[doc = "Register IF2MCTL `reset()`'s with value 0"]
impl crate::ResetValue for super::IF2MCTL {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `DLC`"]
pub type DLC_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `DLC`"]
pub struct DLC_W<'a> {
w: &'a mut W,
}
impl<'a> DLC_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
self.w
}
}
#[doc = "Reader of field `EOB`"]
pub type EOB_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `EOB`"]
pub struct EOB_W<'a> {
w: &'a mut W,
}
impl<'a> EOB_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
self.w
}
}
#[doc = "Reader of field `TXRQST`"]
pub type TXRQST_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TXRQST`"]
pub struct TXRQST_W<'a> {
w: &'a mut W,
}
impl<'a> TXRQST_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
self.w
}
}
#[doc = "Reader of field `RMTEN`"]
pub type RMTEN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `RMTEN`"]
pub struct RMTEN_W<'a> {
w: &'a mut W,
}
impl<'a> RMTEN_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
self.w
}
}
#[doc = "Reader of field `RXIE`"]
pub type RXIE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `RXIE`"]
pub struct RXIE_W<'a> {
w: &'a mut W,
}
impl<'a> RXIE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
self.w
}
}
#[doc = "Reader of field `TXIE`"]
pub type TXIE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `TXIE`"]
pub struct TXIE_W<'a> {
w: &'a mut W,
}
impl<'a> TXIE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
self.w
}
}
#[doc = "Reader of field `UMASK`"]
pub type UMASK_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `UMASK`"]
pub struct UMASK_W<'a> {
w: &'a mut W,
}
impl<'a> UMASK_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
self.w
}
}
#[doc = "Reader of field `INTPND`"]
pub type INTPND_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `INTPND`"]
pub struct INTPND_W<'a> {
w: &'a mut W,
}
impl<'a> INTPND_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
self.w
}
}
#[doc = "Reader of field `MSGLST`"]
pub type MSGLST_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MSGLST`"]
pub struct MSGLST_W<'a> {
w: &'a mut W,
}
impl<'a> MSGLST_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
self.w
}
}
#[doc = "Reader of field `NEWDAT`"]
pub type NEWDAT_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `NEWDAT`"]
pub struct NEWDAT_W<'a> {
w: &'a mut W,
}
impl<'a> NEWDAT_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
self.w
}
}
impl R {
#[doc = "Bits 0:3 - Data Length Code"]
#[inline(always)]
pub fn dlc(&self) -> DLC_R {
DLC_R::new((self.bits & 0x0f) as u8)
}
#[doc = "Bit 7 - End of Buffer"]
#[inline(always)]
pub fn eob(&self) -> EOB_R {
EOB_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 8 - Transmit Request"]
#[inline(always)]
pub fn txrqst(&self) -> TXRQST_R {
TXRQST_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 9 - Remote Enable"]
#[inline(always)]
pub fn rmten(&self) -> RMTEN_R {
RMTEN_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 10 - Receive Interrupt Enable"]
#[inline(always)]
pub fn rxie(&self) -> RXIE_R {
RXIE_R::new(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bit 11 - Transmit Interrupt Enable"]
#[inline(always)]
pub fn txie(&self) -> TXIE_R {
TXIE_R::new(((self.bits >> 11) & 0x01) != 0)
}
#[doc = "Bit 12 - Use Acceptance Mask"]
#[inline(always)]
pub fn umask(&self) -> UMASK_R {
UMASK_R::new(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bit 13 - Interrupt Pending"]
#[inline(always)]
pub fn intpnd(&self) -> INTPND_R {
INTPND_R::new(((self.bits >> 13) & 0x01) != 0)
}
#[doc = "Bit 14 - Message Lost"]
#[inline(always)]
pub fn msglst(&self) -> MSGLST_R {
MSGLST_R::new(((self.bits >> 14) & 0x01) != 0)
}
#[doc = "Bit 15 - New Data"]
#[inline(always)]
pub fn newdat(&self) -> NEWDAT_R {
NEWDAT_R::new(((self.bits >> 15) & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 0:3 - Data Length Code"]
#[inline(always)]
pub fn dlc(&mut self) -> DLC_W {
DLC_W { w: self }
}
#[doc = "Bit 7 - End of Buffer"]
#[inline(always)]
pub fn eob(&mut self) -> EOB_W {
EOB_W { w: self }
}
#[doc = "Bit 8 - Transmit Request"]
#[inline(always)]
pub fn txrqst(&mut self) -> TXRQST_W {
TXRQST_W { w: self }
}
#[doc = "Bit 9 - Remote Enable"]
#[inline(always)]
pub fn rmten(&mut self) -> RMTEN_W {
RMTEN_W { w: self }
}
#[doc = "Bit 10 - Receive Interrupt Enable"]
#[inline(always)]
pub fn rxie(&mut self) -> RXIE_W {
RXIE_W { w: self }
}
#[doc = "Bit 11 - Transmit Interrupt Enable"]
#[inline(always)]
pub fn txie(&mut self) -> TXIE_W {
TXIE_W { w: self }
}
#[doc = "Bit 12 - Use Acceptance Mask"]
#[inline(always)]
pub fn umask(&mut self) -> UMASK_W {
UMASK_W { w: self }
}
#[doc = "Bit 13 - Interrupt Pending"]
#[inline(always)]
pub fn intpnd(&mut self) -> INTPND_W {
INTPND_W { w: self }
}
#[doc = "Bit 14 - Message Lost"]
#[inline(always)]
pub fn msglst(&mut self) -> MSGLST_W {
MSGLST_W { w: self }
}
#[doc = "Bit 15 - New Data"]
#[inline(always)]
pub fn newdat(&mut self) -> NEWDAT_W {
NEWDAT_W { w: self }
}
}