#[doc = "Register `PONG_CTL` reader"]
pub struct R(crate::R<PONG_CTL_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<PONG_CTL_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<PONG_CTL_SPEC>> for R {
    fn from(reader: crate::R<PONG_CTL_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `PONG_CTL` writer"]
pub struct W(crate::W<PONG_CTL_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<PONG_CTL_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<PONG_CTL_SPEC>> for W {
    fn from(writer: crate::W<PONG_CTL_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `DATA_NR` reader - See description of PING_CTL."]
pub struct DATA_NR_R(crate::FieldReader<u16, u16>);
impl DATA_NR_R {
    pub(crate) fn new(bits: u16) -> Self {
        DATA_NR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for DATA_NR_R {
    type Target = crate::FieldReader<u16, u16>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DATA_NR` writer - See description of PING_CTL."]
pub struct DATA_NR_W<'a> {
    w: &'a mut W,
}
impl<'a> DATA_NR_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits = (self.w.bits & !0xffff) | (value as u32 & 0xffff);
        self.w
    }
}
#[doc = "Field `DATA_SIZE` reader - See description of PING_CTL."]
pub struct DATA_SIZE_R(crate::FieldReader<u8, u8>);
impl DATA_SIZE_R {
    pub(crate) fn new(bits: u8) -> Self {
        DATA_SIZE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for DATA_SIZE_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DATA_SIZE` writer - See description of PING_CTL."]
pub struct DATA_SIZE_W<'a> {
    w: &'a mut W,
}
impl<'a> DATA_SIZE_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 & !(0x03 << 16)) | ((value as u32 & 0x03) << 16);
        self.w
    }
}
#[doc = "Field `DST_TRANSFER_SIZE` reader - See description of PING_CTL."]
pub struct DST_TRANSFER_SIZE_R(crate::FieldReader<bool, bool>);
impl DST_TRANSFER_SIZE_R {
    pub(crate) fn new(bits: bool) -> Self {
        DST_TRANSFER_SIZE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for DST_TRANSFER_SIZE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DST_TRANSFER_SIZE` writer - See description of PING_CTL."]
pub struct DST_TRANSFER_SIZE_W<'a> {
    w: &'a mut W,
}
impl<'a> DST_TRANSFER_SIZE_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 `DST_ADDR_INCR` reader - See description of PING_CTL."]
pub struct DST_ADDR_INCR_R(crate::FieldReader<bool, bool>);
impl DST_ADDR_INCR_R {
    pub(crate) fn new(bits: bool) -> Self {
        DST_ADDR_INCR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for DST_ADDR_INCR_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DST_ADDR_INCR` writer - See description of PING_CTL."]
pub struct DST_ADDR_INCR_W<'a> {
    w: &'a mut W,
}
impl<'a> DST_ADDR_INCR_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 `SRC_TRANSFER_SIZE` reader - See description of PING_CTL."]
pub struct SRC_TRANSFER_SIZE_R(crate::FieldReader<bool, bool>);
impl SRC_TRANSFER_SIZE_R {
    pub(crate) fn new(bits: bool) -> Self {
        SRC_TRANSFER_SIZE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for SRC_TRANSFER_SIZE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SRC_TRANSFER_SIZE` writer - See description of PING_CTL."]
pub struct SRC_TRANSFER_SIZE_W<'a> {
    w: &'a mut W,
}
impl<'a> SRC_TRANSFER_SIZE_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 << 22)) | ((value as u32 & 0x01) << 22);
        self.w
    }
}
#[doc = "Field `SRC_ADDR_INCR` reader - See description of PING_CTL."]
pub struct SRC_ADDR_INCR_R(crate::FieldReader<bool, bool>);
impl SRC_ADDR_INCR_R {
    pub(crate) fn new(bits: bool) -> Self {
        SRC_ADDR_INCR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for SRC_ADDR_INCR_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SRC_ADDR_INCR` writer - See description of PING_CTL."]
pub struct SRC_ADDR_INCR_W<'a> {
    w: &'a mut W,
}
impl<'a> SRC_ADDR_INCR_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
    }
}
#[doc = "Field `WAIT_FOR_DEACT` reader - See description of PING_CTL."]
pub struct WAIT_FOR_DEACT_R(crate::FieldReader<u8, u8>);
impl WAIT_FOR_DEACT_R {
    pub(crate) fn new(bits: u8) -> Self {
        WAIT_FOR_DEACT_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for WAIT_FOR_DEACT_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `WAIT_FOR_DEACT` writer - See description of PING_CTL."]
pub struct WAIT_FOR_DEACT_W<'a> {
    w: &'a mut W,
}
impl<'a> WAIT_FOR_DEACT_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 & !(0x03 << 24)) | ((value as u32 & 0x03) << 24);
        self.w
    }
}
#[doc = "Field `INV_DESCR` reader - See description of PING_CTL."]
pub struct INV_DESCR_R(crate::FieldReader<bool, bool>);
impl INV_DESCR_R {
    pub(crate) fn new(bits: bool) -> Self {
        INV_DESCR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for INV_DESCR_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `INV_DESCR` writer - See description of PING_CTL."]
pub struct INV_DESCR_W<'a> {
    w: &'a mut W,
}
impl<'a> INV_DESCR_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 << 26)) | ((value as u32 & 0x01) << 26);
        self.w
    }
}
#[doc = "Field `SET_CAUSE` reader - See description of PING_CTL."]
pub struct SET_CAUSE_R(crate::FieldReader<bool, bool>);
impl SET_CAUSE_R {
    pub(crate) fn new(bits: bool) -> Self {
        SET_CAUSE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for SET_CAUSE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SET_CAUSE` writer - See description of PING_CTL."]
pub struct SET_CAUSE_W<'a> {
    w: &'a mut W,
}
impl<'a> SET_CAUSE_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 << 27)) | ((value as u32 & 0x01) << 27);
        self.w
    }
}
#[doc = "Field `PREEMPTABLE` reader - See description of PING_CTL."]
pub struct PREEMPTABLE_R(crate::FieldReader<bool, bool>);
impl PREEMPTABLE_R {
    pub(crate) fn new(bits: bool) -> Self {
        PREEMPTABLE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for PREEMPTABLE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `PREEMPTABLE` writer - See description of PING_CTL."]
pub struct PREEMPTABLE_W<'a> {
    w: &'a mut W,
}
impl<'a> PREEMPTABLE_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 << 28)) | ((value as u32 & 0x01) << 28);
        self.w
    }
}
#[doc = "Field `FLIPPING` reader - See description of PING_CTL."]
pub struct FLIPPING_R(crate::FieldReader<bool, bool>);
impl FLIPPING_R {
    pub(crate) fn new(bits: bool) -> Self {
        FLIPPING_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for FLIPPING_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `FLIPPING` writer - See description of PING_CTL."]
pub struct FLIPPING_W<'a> {
    w: &'a mut W,
}
impl<'a> FLIPPING_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 << 29)) | ((value as u32 & 0x01) << 29);
        self.w
    }
}
#[doc = "Field `OPCODE` reader - See description of PING_CTL."]
pub struct OPCODE_R(crate::FieldReader<u8, u8>);
impl OPCODE_R {
    pub(crate) fn new(bits: u8) -> Self {
        OPCODE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for OPCODE_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `OPCODE` writer - See description of PING_CTL."]
pub struct OPCODE_W<'a> {
    w: &'a mut W,
}
impl<'a> OPCODE_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 & !(0x03 << 30)) | ((value as u32 & 0x03) << 30);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:15 - See description of PING_CTL."]
    #[inline(always)]
    pub fn data_nr(&self) -> DATA_NR_R {
        DATA_NR_R::new((self.bits & 0xffff) as u16)
    }
    #[doc = "Bits 16:17 - See description of PING_CTL."]
    #[inline(always)]
    pub fn data_size(&self) -> DATA_SIZE_R {
        DATA_SIZE_R::new(((self.bits >> 16) & 0x03) as u8)
    }
    #[doc = "Bit 20 - See description of PING_CTL."]
    #[inline(always)]
    pub fn dst_transfer_size(&self) -> DST_TRANSFER_SIZE_R {
        DST_TRANSFER_SIZE_R::new(((self.bits >> 20) & 0x01) != 0)
    }
    #[doc = "Bit 21 - See description of PING_CTL."]
    #[inline(always)]
    pub fn dst_addr_incr(&self) -> DST_ADDR_INCR_R {
        DST_ADDR_INCR_R::new(((self.bits >> 21) & 0x01) != 0)
    }
    #[doc = "Bit 22 - See description of PING_CTL."]
    #[inline(always)]
    pub fn src_transfer_size(&self) -> SRC_TRANSFER_SIZE_R {
        SRC_TRANSFER_SIZE_R::new(((self.bits >> 22) & 0x01) != 0)
    }
    #[doc = "Bit 23 - See description of PING_CTL."]
    #[inline(always)]
    pub fn src_addr_incr(&self) -> SRC_ADDR_INCR_R {
        SRC_ADDR_INCR_R::new(((self.bits >> 23) & 0x01) != 0)
    }
    #[doc = "Bits 24:25 - See description of PING_CTL."]
    #[inline(always)]
    pub fn wait_for_deact(&self) -> WAIT_FOR_DEACT_R {
        WAIT_FOR_DEACT_R::new(((self.bits >> 24) & 0x03) as u8)
    }
    #[doc = "Bit 26 - See description of PING_CTL."]
    #[inline(always)]
    pub fn inv_descr(&self) -> INV_DESCR_R {
        INV_DESCR_R::new(((self.bits >> 26) & 0x01) != 0)
    }
    #[doc = "Bit 27 - See description of PING_CTL."]
    #[inline(always)]
    pub fn set_cause(&self) -> SET_CAUSE_R {
        SET_CAUSE_R::new(((self.bits >> 27) & 0x01) != 0)
    }
    #[doc = "Bit 28 - See description of PING_CTL."]
    #[inline(always)]
    pub fn preemptable(&self) -> PREEMPTABLE_R {
        PREEMPTABLE_R::new(((self.bits >> 28) & 0x01) != 0)
    }
    #[doc = "Bit 29 - See description of PING_CTL."]
    #[inline(always)]
    pub fn flipping(&self) -> FLIPPING_R {
        FLIPPING_R::new(((self.bits >> 29) & 0x01) != 0)
    }
    #[doc = "Bits 30:31 - See description of PING_CTL."]
    #[inline(always)]
    pub fn opcode(&self) -> OPCODE_R {
        OPCODE_R::new(((self.bits >> 30) & 0x03) as u8)
    }
}
impl W {
    #[doc = "Bits 0:15 - See description of PING_CTL."]
    #[inline(always)]
    pub fn data_nr(&mut self) -> DATA_NR_W {
        DATA_NR_W { w: self }
    }
    #[doc = "Bits 16:17 - See description of PING_CTL."]
    #[inline(always)]
    pub fn data_size(&mut self) -> DATA_SIZE_W {
        DATA_SIZE_W { w: self }
    }
    #[doc = "Bit 20 - See description of PING_CTL."]
    #[inline(always)]
    pub fn dst_transfer_size(&mut self) -> DST_TRANSFER_SIZE_W {
        DST_TRANSFER_SIZE_W { w: self }
    }
    #[doc = "Bit 21 - See description of PING_CTL."]
    #[inline(always)]
    pub fn dst_addr_incr(&mut self) -> DST_ADDR_INCR_W {
        DST_ADDR_INCR_W { w: self }
    }
    #[doc = "Bit 22 - See description of PING_CTL."]
    #[inline(always)]
    pub fn src_transfer_size(&mut self) -> SRC_TRANSFER_SIZE_W {
        SRC_TRANSFER_SIZE_W { w: self }
    }
    #[doc = "Bit 23 - See description of PING_CTL."]
    #[inline(always)]
    pub fn src_addr_incr(&mut self) -> SRC_ADDR_INCR_W {
        SRC_ADDR_INCR_W { w: self }
    }
    #[doc = "Bits 24:25 - See description of PING_CTL."]
    #[inline(always)]
    pub fn wait_for_deact(&mut self) -> WAIT_FOR_DEACT_W {
        WAIT_FOR_DEACT_W { w: self }
    }
    #[doc = "Bit 26 - See description of PING_CTL."]
    #[inline(always)]
    pub fn inv_descr(&mut self) -> INV_DESCR_W {
        INV_DESCR_W { w: self }
    }
    #[doc = "Bit 27 - See description of PING_CTL."]
    #[inline(always)]
    pub fn set_cause(&mut self) -> SET_CAUSE_W {
        SET_CAUSE_W { w: self }
    }
    #[doc = "Bit 28 - See description of PING_CTL."]
    #[inline(always)]
    pub fn preemptable(&mut self) -> PREEMPTABLE_W {
        PREEMPTABLE_W { w: self }
    }
    #[doc = "Bit 29 - See description of PING_CTL."]
    #[inline(always)]
    pub fn flipping(&mut self) -> FLIPPING_W {
        FLIPPING_W { w: self }
    }
    #[doc = "Bits 30:31 - See description of PING_CTL."]
    #[inline(always)]
    pub fn opcode(&mut self) -> OPCODE_W {
        OPCODE_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 = "Pong control word\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 [pong_ctl](index.html) module"]
pub struct PONG_CTL_SPEC;
impl crate::RegisterSpec for PONG_CTL_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [pong_ctl::R](R) reader structure"]
impl crate::Readable for PONG_CTL_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [pong_ctl::W](W) writer structure"]
impl crate::Writable for PONG_CTL_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets PONG_CTL to value 0"]
impl crate::Resettable for PONG_CTL_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
