#[doc = "Register `CHAN_RESULT4` reader"]
pub struct R(crate::R<CHAN_RESULT4_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CHAN_RESULT4_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CHAN_RESULT4_SPEC>> for R {
    fn from(reader: crate::R<CHAN_RESULT4_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CHAN_RESULT4` writer"]
pub struct W(crate::W<CHAN_RESULT4_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CHAN_RESULT4_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<CHAN_RESULT4_SPEC>> for W {
    fn from(writer: crate::W<CHAN_RESULT4_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `RESULT` reader - SAR conversion result of the channel. The data is copied here from the WORK field after all enabled channels in this scan have been sampled."]
pub struct RESULT_R(crate::FieldReader<u16, u16>);
impl RESULT_R {
    pub(crate) fn new(bits: u16) -> Self {
        RESULT_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for RESULT_R {
    type Target = crate::FieldReader<u16, u16>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SATURATE_INTR_MIR` reader - mirror bit of corresponding bit in SAR_SATURATE_INTR register"]
pub struct SATURATE_INTR_MIR_R(crate::FieldReader<bool, bool>);
impl SATURATE_INTR_MIR_R {
    pub(crate) fn new(bits: bool) -> Self {
        SATURATE_INTR_MIR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for SATURATE_INTR_MIR_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RANGE_INTR_MIR` reader - mirror bit of corresponding bit in SAR_RANGE_INTR register"]
pub struct RANGE_INTR_MIR_R(crate::FieldReader<bool, bool>);
impl RANGE_INTR_MIR_R {
    pub(crate) fn new(bits: bool) -> Self {
        RANGE_INTR_MIR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for RANGE_INTR_MIR_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CHAN_RESULT_VALID_MIR` reader - mirror bit of corresponding bit in SAR_CHAN_RESULT_VALID register"]
pub struct CHAN_RESULT_VALID_MIR_R(crate::FieldReader<bool, bool>);
impl CHAN_RESULT_VALID_MIR_R {
    pub(crate) fn new(bits: bool) -> Self {
        CHAN_RESULT_VALID_MIR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for CHAN_RESULT_VALID_MIR_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl R {
    #[doc = "Bits 0:15 - SAR conversion result of the channel. The data is copied here from the WORK field after all enabled channels in this scan have been sampled."]
    #[inline(always)]
    pub fn result(&self) -> RESULT_R {
        RESULT_R::new((self.bits & 0xffff) as u16)
    }
    #[doc = "Bit 29 - mirror bit of corresponding bit in SAR_SATURATE_INTR register"]
    #[inline(always)]
    pub fn saturate_intr_mir(&self) -> SATURATE_INTR_MIR_R {
        SATURATE_INTR_MIR_R::new(((self.bits >> 29) & 0x01) != 0)
    }
    #[doc = "Bit 30 - mirror bit of corresponding bit in SAR_RANGE_INTR register"]
    #[inline(always)]
    pub fn range_intr_mir(&self) -> RANGE_INTR_MIR_R {
        RANGE_INTR_MIR_R::new(((self.bits >> 30) & 0x01) != 0)
    }
    #[doc = "Bit 31 - mirror bit of corresponding bit in SAR_CHAN_RESULT_VALID register"]
    #[inline(always)]
    pub fn chan_result_valid_mir(&self) -> CHAN_RESULT_VALID_MIR_R {
        CHAN_RESULT_VALID_MIR_R::new(((self.bits >> 31) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Channel result data register\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 [chan_result4](index.html) module"]
pub struct CHAN_RESULT4_SPEC;
impl crate::RegisterSpec for CHAN_RESULT4_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [chan_result4::R](R) reader structure"]
impl crate::Readable for CHAN_RESULT4_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [chan_result4::W](W) writer structure"]
impl crate::Writable for CHAN_RESULT4_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CHAN_RESULT4 to value 0"]
impl crate::Resettable for CHAN_RESULT4_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
