#[doc = "Register `PONG_STATUS` reader"]
pub struct R(crate::R<PONG_STATUS_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<PONG_STATUS_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<PONG_STATUS_SPEC>> for R {
    fn from(reader: crate::R<PONG_STATUS_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `PONG_STATUS` writer"]
pub struct W(crate::W<PONG_STATUS_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<PONG_STATUS_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_STATUS_SPEC>> for W {
    fn from(writer: crate::W<PONG_STATUS_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `CURR_DATA_NR` reader - See description of PING_STATUS."]
pub struct CURR_DATA_NR_R(crate::FieldReader<u16, u16>);
impl CURR_DATA_NR_R {
    pub(crate) fn new(bits: u16) -> Self {
        CURR_DATA_NR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for CURR_DATA_NR_R {
    type Target = crate::FieldReader<u16, u16>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CURR_DATA_NR` writer - See description of PING_STATUS."]
pub struct CURR_DATA_NR_W<'a> {
    w: &'a mut W,
}
impl<'a> CURR_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 `RESPONSE` reader - See description of PING_STATUS."]
pub struct RESPONSE_R(crate::FieldReader<u8, u8>);
impl RESPONSE_R {
    pub(crate) fn new(bits: u8) -> Self {
        RESPONSE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for RESPONSE_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RESPONSE` writer - See description of PING_STATUS."]
pub struct RESPONSE_W<'a> {
    w: &'a mut W,
}
impl<'a> RESPONSE_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 & !(0x07 << 16)) | ((value as u32 & 0x07) << 16);
        self.w
    }
}
#[doc = "Field `VALID` reader - See description of PING_STATUS."]
pub struct VALID_R(crate::FieldReader<bool, bool>);
impl VALID_R {
    pub(crate) fn new(bits: bool) -> Self {
        VALID_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for VALID_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `VALID` writer - See description of PING_STATUS."]
pub struct VALID_W<'a> {
    w: &'a mut W,
}
impl<'a> VALID_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 << 31)) | ((value as u32 & 0x01) << 31);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:15 - See description of PING_STATUS."]
    #[inline(always)]
    pub fn curr_data_nr(&self) -> CURR_DATA_NR_R {
        CURR_DATA_NR_R::new((self.bits & 0xffff) as u16)
    }
    #[doc = "Bits 16:18 - See description of PING_STATUS."]
    #[inline(always)]
    pub fn response(&self) -> RESPONSE_R {
        RESPONSE_R::new(((self.bits >> 16) & 0x07) as u8)
    }
    #[doc = "Bit 31 - See description of PING_STATUS."]
    #[inline(always)]
    pub fn valid(&self) -> VALID_R {
        VALID_R::new(((self.bits >> 31) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:15 - See description of PING_STATUS."]
    #[inline(always)]
    pub fn curr_data_nr(&mut self) -> CURR_DATA_NR_W {
        CURR_DATA_NR_W { w: self }
    }
    #[doc = "Bits 16:18 - See description of PING_STATUS."]
    #[inline(always)]
    pub fn response(&mut self) -> RESPONSE_W {
        RESPONSE_W { w: self }
    }
    #[doc = "Bit 31 - See description of PING_STATUS."]
    #[inline(always)]
    pub fn valid(&mut self) -> VALID_W {
        VALID_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 status 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_status](index.html) module"]
pub struct PONG_STATUS_SPEC;
impl crate::RegisterSpec for PONG_STATUS_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [pong_status::R](R) reader structure"]
impl crate::Readable for PONG_STATUS_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [pong_status::W](W) writer structure"]
impl crate::Writable for PONG_STATUS_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets PONG_STATUS to value 0"]
impl crate::Resettable for PONG_STATUS_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
