#[doc = "Register `CONTROL` reader"]
pub struct R(crate::R<CONTROL_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CONTROL_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CONTROL_SPEC>> for R {
    fn from(reader: crate::R<CONTROL_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CONTROL` writer"]
pub struct W(crate::W<CONTROL_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CONTROL_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<CONTROL_SPEC>> for W {
    fn from(writer: crate::W<CONTROL_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `TX_REQ` reader - TxReq, Transmit Request?Write:?'0': idle?'1': Message Transmit Request5?Read:?'0': TxReq completed?'1': TxReq pending"]
pub struct TX_REQ_R(crate::FieldReader<bool, bool>);
impl TX_REQ_R {
    pub(crate) fn new(bits: bool) -> Self {
        TX_REQ_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TX_REQ_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TX_REQ` writer - TxReq, Transmit Request?Write:?'0': idle?'1': Message Transmit Request5?Read:?'0': TxReq completed?'1': TxReq pending"]
pub struct TX_REQ_W<'a> {
    w: &'a mut W,
}
impl<'a> TX_REQ_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) | (value as u32 & 0x01);
        self.w
    }
}
#[doc = "Field `TX_ABORT` reader - Transmit Abort Request?'0': idle??1': Requests removal of a pending message. ?The message is removed the next time an arbitration?loss happens or a CAN error is detected. ?The flag is cleared when the message was removed or when the?message won arbitration. ?The TxReq flag is released at the same time??when there is a pending TX message (read out TxReq=1 and TxAbort=0), Writing TxReq=1 and TxAbort=1 has no effect.??for SST message,when the message is aborted, the TxReq fag is cleared, but the TxAbort fag remains asserted."]
pub struct TX_ABORT_R(crate::FieldReader<bool, bool>);
impl TX_ABORT_R {
    pub(crate) fn new(bits: bool) -> Self {
        TX_ABORT_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TX_ABORT_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TX_ABORT` writer - Transmit Abort Request?'0': idle??1': Requests removal of a pending message. ?The message is removed the next time an arbitration?loss happens or a CAN error is detected. ?The flag is cleared when the message was removed or when the?message won arbitration. ?The TxReq flag is released at the same time??when there is a pending TX message (read out TxReq=1 and TxAbort=0), Writing TxReq=1 and TxAbort=1 has no effect.??for SST message,when the message is aborted, the TxReq fag is cleared, but the TxAbort fag remains asserted."]
pub struct TX_ABORT_W<'a> {
    w: &'a mut W,
}
impl<'a> TX_ABORT_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 << 1)) | ((value as u32 & 0x01) << 1);
        self.w
    }
}
#[doc = "Field `TX_INT_EBL` reader - Tx Interrupt Enable??0?: Interrupt disabled??1?: Interrupt enabled, successful message transmission?sets the TxMsg"]
pub struct TX_INT_EBL_R(crate::FieldReader<bool, bool>);
impl TX_INT_EBL_R {
    pub(crate) fn new(bits: bool) -> Self {
        TX_INT_EBL_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TX_INT_EBL_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TX_INT_EBL` writer - Tx Interrupt Enable??0?: Interrupt disabled??1?: Interrupt enabled, successful message transmission?sets the TxMsg"]
pub struct TX_INT_EBL_W<'a> {
    w: &'a mut W,
}
impl<'a> TX_INT_EBL_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 << 2)) | ((value as u32 & 0x01) << 2);
        self.w
    }
}
#[doc = "Field `WPNL` reader - WPNL: Write protection for bit \\[2\\].?'0': Bit \\[2\\]
is write protected,?'1': Bit \\[2\\]
is modified by writes?The WPNL bit must always be set in the same write that is modifying bit \\[2\\]
as this bit state is not preserved. ?This WPNL bit is always zero for readback."]
pub struct WPNL_R(crate::FieldReader<bool, bool>);
impl WPNL_R {
    pub(crate) fn new(bits: bool) -> Self {
        WPNL_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for WPNL_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `WPNL` writer - WPNL: Write protection for bit \\[2\\].?'0': Bit \\[2\\]
is write protected,?'1': Bit \\[2\\]
is modified by writes?The WPNL bit must always be set in the same write that is modifying bit \\[2\\]
as this bit state is not preserved. ?This WPNL bit is always zero for readback."]
pub struct WPNL_W<'a> {
    w: &'a mut W,
}
impl<'a> WPNL_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 << 3)) | ((value as u32 & 0x01) << 3);
        self.w
    }
}
#[doc = "Field `DLC` reader - DLC, Data Length Code?Invalid values are transmitted as they are, but the?number of data bytes is limited to eight.?0: Message has 0 data byte, data\\[63:0\\]
is not used?1: Message has 1 data byte, data\\[63:56\\]
is used?...?8: Message has 8 data bytes, data\\[63:0\\]
is used?9-15: Message has 8 data bytes"]
pub struct DLC_R(crate::FieldReader<u8, u8>);
impl DLC_R {
    pub(crate) fn new(bits: u8) -> Self {
        DLC_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for DLC_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DLC` writer - DLC, Data Length Code?Invalid values are transmitted as they are, but the?number of data bytes is limited to eight.?0: Message has 0 data byte, data\\[63:0\\]
is not used?1: Message has 1 data byte, data\\[63:56\\]
is used?...?8: Message has 8 data bytes, data\\[63:0\\]
is used?9-15: Message has 8 data bytes"]
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 << 16)) | ((value as u32 & 0x0f) << 16);
        self.w
    }
}
#[doc = "Field `IDE` reader - Extended Identifier Bit?'0': This is a standard format message?'1': This is an extended format message"]
pub struct IDE_R(crate::FieldReader<bool, bool>);
impl IDE_R {
    pub(crate) fn new(bits: bool) -> Self {
        IDE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for IDE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `IDE` writer - Extended Identifier Bit?'0': This is a standard format message?'1': This is an extended format message"]
pub struct IDE_W<'a> {
    w: &'a mut W,
}
impl<'a> IDE_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 << 20)) | ((value as u32 & 0x01) << 20);
        self.w
    }
}
#[doc = "Field `RTR` reader - Remote Bit?'0': This is a standard message?'1': This is an RTR message"]
pub struct RTR_R(crate::FieldReader<bool, bool>);
impl RTR_R {
    pub(crate) fn new(bits: bool) -> Self {
        RTR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for RTR_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RTR` writer - Remote Bit?'0': This is a standard message?'1': This is an RTR message"]
pub struct RTR_W<'a> {
    w: &'a mut W,
}
impl<'a> RTR_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 << 21)) | ((value as u32 & 0x01) << 21);
        self.w
    }
}
#[doc = "Field `WPNH` reader - WPNH, Write Protection for bits\\[21:16\\].?'0': Bit \\[21:16\\]
are write protected,?'1': Bit \\[21:16\\]
are modified by writes.?The WPNH bit must always be set in the same write that is modifying bits \\[21:16\\]
as this bit state is not preserved. ?The readback value of this bit is undefined."]
pub struct WPNH_R(crate::FieldReader<bool, bool>);
impl WPNH_R {
    pub(crate) fn new(bits: bool) -> Self {
        WPNH_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for WPNH_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `WPNH` writer - WPNH, Write Protection for bits\\[21:16\\].?'0': Bit \\[21:16\\]
are write protected,?'1': Bit \\[21:16\\]
are modified by writes.?The WPNH bit must always be set in the same write that is modifying bits \\[21:16\\]
as this bit state is not preserved. ?The readback value of this bit is undefined."]
pub struct WPNH_W<'a> {
    w: &'a mut W,
}
impl<'a> WPNH_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 << 23)) | ((value as u32 & 0x01) << 23);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - TxReq, Transmit Request?Write:?'0': idle?'1': Message Transmit Request5?Read:?'0': TxReq completed?'1': TxReq pending"]
    #[inline(always)]
    pub fn tx_req(&self) -> TX_REQ_R {
        TX_REQ_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 1 - Transmit Abort Request?'0': idle??1': Requests removal of a pending message. ?The message is removed the next time an arbitration?loss happens or a CAN error is detected. ?The flag is cleared when the message was removed or when the?message won arbitration. ?The TxReq flag is released at the same time??when there is a pending TX message (read out TxReq=1 and TxAbort=0), Writing TxReq=1 and TxAbort=1 has no effect.??for SST message,when the message is aborted, the TxReq fag is cleared, but the TxAbort fag remains asserted."]
    #[inline(always)]
    pub fn tx_abort(&self) -> TX_ABORT_R {
        TX_ABORT_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 2 - Tx Interrupt Enable??0?: Interrupt disabled??1?: Interrupt enabled, successful message transmission?sets the TxMsg"]
    #[inline(always)]
    pub fn tx_int_ebl(&self) -> TX_INT_EBL_R {
        TX_INT_EBL_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 3 - WPNL: Write protection for bit \\[2\\].?'0': Bit \\[2\\]
is write protected,?'1': Bit \\[2\\]
is modified by writes?The WPNL bit must always be set in the same write that is modifying bit \\[2\\]
as this bit state is not preserved. ?This WPNL bit is always zero for readback."]
    #[inline(always)]
    pub fn wpnl(&self) -> WPNL_R {
        WPNL_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bits 16:19 - DLC, Data Length Code?Invalid values are transmitted as they are, but the?number of data bytes is limited to eight.?0: Message has 0 data byte, data\\[63:0\\]
is not used?1: Message has 1 data byte, data\\[63:56\\]
is used?...?8: Message has 8 data bytes, data\\[63:0\\]
is used?9-15: Message has 8 data bytes"]
    #[inline(always)]
    pub fn dlc(&self) -> DLC_R {
        DLC_R::new(((self.bits >> 16) & 0x0f) as u8)
    }
    #[doc = "Bit 20 - Extended Identifier Bit?'0': This is a standard format message?'1': This is an extended format message"]
    #[inline(always)]
    pub fn ide(&self) -> IDE_R {
        IDE_R::new(((self.bits >> 20) & 0x01) != 0)
    }
    #[doc = "Bit 21 - Remote Bit?'0': This is a standard message?'1': This is an RTR message"]
    #[inline(always)]
    pub fn rtr(&self) -> RTR_R {
        RTR_R::new(((self.bits >> 21) & 0x01) != 0)
    }
    #[doc = "Bit 23 - WPNH, Write Protection for bits\\[21:16\\].?'0': Bit \\[21:16\\]
are write protected,?'1': Bit \\[21:16\\]
are modified by writes.?The WPNH bit must always be set in the same write that is modifying bits \\[21:16\\]
as this bit state is not preserved. ?The readback value of this bit is undefined."]
    #[inline(always)]
    pub fn wpnh(&self) -> WPNH_R {
        WPNH_R::new(((self.bits >> 23) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - TxReq, Transmit Request?Write:?'0': idle?'1': Message Transmit Request5?Read:?'0': TxReq completed?'1': TxReq pending"]
    #[inline(always)]
    pub fn tx_req(&mut self) -> TX_REQ_W {
        TX_REQ_W { w: self }
    }
    #[doc = "Bit 1 - Transmit Abort Request?'0': idle??1': Requests removal of a pending message. ?The message is removed the next time an arbitration?loss happens or a CAN error is detected. ?The flag is cleared when the message was removed or when the?message won arbitration. ?The TxReq flag is released at the same time??when there is a pending TX message (read out TxReq=1 and TxAbort=0), Writing TxReq=1 and TxAbort=1 has no effect.??for SST message,when the message is aborted, the TxReq fag is cleared, but the TxAbort fag remains asserted."]
    #[inline(always)]
    pub fn tx_abort(&mut self) -> TX_ABORT_W {
        TX_ABORT_W { w: self }
    }
    #[doc = "Bit 2 - Tx Interrupt Enable??0?: Interrupt disabled??1?: Interrupt enabled, successful message transmission?sets the TxMsg"]
    #[inline(always)]
    pub fn tx_int_ebl(&mut self) -> TX_INT_EBL_W {
        TX_INT_EBL_W { w: self }
    }
    #[doc = "Bit 3 - WPNL: Write protection for bit \\[2\\].?'0': Bit \\[2\\]
is write protected,?'1': Bit \\[2\\]
is modified by writes?The WPNL bit must always be set in the same write that is modifying bit \\[2\\]
as this bit state is not preserved. ?This WPNL bit is always zero for readback."]
    #[inline(always)]
    pub fn wpnl(&mut self) -> WPNL_W {
        WPNL_W { w: self }
    }
    #[doc = "Bits 16:19 - DLC, Data Length Code?Invalid values are transmitted as they are, but the?number of data bytes is limited to eight.?0: Message has 0 data byte, data\\[63:0\\]
is not used?1: Message has 1 data byte, data\\[63:56\\]
is used?...?8: Message has 8 data bytes, data\\[63:0\\]
is used?9-15: Message has 8 data bytes"]
    #[inline(always)]
    pub fn dlc(&mut self) -> DLC_W {
        DLC_W { w: self }
    }
    #[doc = "Bit 20 - Extended Identifier Bit?'0': This is a standard format message?'1': This is an extended format message"]
    #[inline(always)]
    pub fn ide(&mut self) -> IDE_W {
        IDE_W { w: self }
    }
    #[doc = "Bit 21 - Remote Bit?'0': This is a standard message?'1': This is an RTR message"]
    #[inline(always)]
    pub fn rtr(&mut self) -> RTR_W {
        RTR_W { w: self }
    }
    #[doc = "Bit 23 - WPNH, Write Protection for bits\\[21:16\\].?'0': Bit \\[21:16\\]
are write protected,?'1': Bit \\[21:16\\]
are modified by writes.?The WPNH bit must always be set in the same write that is modifying bits \\[21:16\\]
as this bit state is not preserved. ?The readback value of this bit is undefined."]
    #[inline(always)]
    pub fn wpnh(&mut self) -> WPNH_W {
        WPNH_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "TxMessage Buffer control/command\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [control](index.html) module"]
pub struct CONTROL_SPEC;
impl crate::RegisterSpec for CONTROL_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [control::R](R) reader structure"]
impl crate::Readable for CONTROL_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [control::W](W) writer structure"]
impl crate::Writable for CONTROL_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CONTROL to value 0"]
impl crate::Resettable for CONTROL_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
