esp32 0.10.0

Peripheral access crate for the ESP32
Documentation
#[doc = "Register `SAR_TOUCH_CTRL2` reader"]
pub struct R(crate::R<SAR_TOUCH_CTRL2_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<SAR_TOUCH_CTRL2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<SAR_TOUCH_CTRL2_SPEC>> for R {
    fn from(reader: crate::R<SAR_TOUCH_CTRL2_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `SAR_TOUCH_CTRL2` writer"]
pub struct W(crate::W<SAR_TOUCH_CTRL2_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<SAR_TOUCH_CTRL2_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<SAR_TOUCH_CTRL2_SPEC>> for W {
    fn from(writer: crate::W<SAR_TOUCH_CTRL2_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `TOUCH_MEAS_EN_CLR` reader - "]
pub struct TOUCH_MEAS_EN_CLR_R(crate::FieldReader<bool, bool>);
impl TOUCH_MEAS_EN_CLR_R {
    pub(crate) fn new(bits: bool) -> Self {
        TOUCH_MEAS_EN_CLR_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TOUCH_MEAS_EN_CLR_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TOUCH_MEAS_EN_CLR` writer - "]
pub struct TOUCH_MEAS_EN_CLR_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUCH_MEAS_EN_CLR_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 << 30)) | (((value as u32) & 0x01) << 30);
        self.w
    }
}
#[doc = "Field `TOUCH_SLEEP_CYCLES` reader - "]
pub struct TOUCH_SLEEP_CYCLES_R(crate::FieldReader<u16, u16>);
impl TOUCH_SLEEP_CYCLES_R {
    pub(crate) fn new(bits: u16) -> Self {
        TOUCH_SLEEP_CYCLES_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TOUCH_SLEEP_CYCLES_R {
    type Target = crate::FieldReader<u16, u16>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TOUCH_SLEEP_CYCLES` writer - "]
pub struct TOUCH_SLEEP_CYCLES_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUCH_SLEEP_CYCLES_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 << 14)) | (((value as u32) & 0xffff) << 14);
        self.w
    }
}
#[doc = "Field `TOUCH_START_FORCE` reader - "]
pub struct TOUCH_START_FORCE_R(crate::FieldReader<bool, bool>);
impl TOUCH_START_FORCE_R {
    pub(crate) fn new(bits: bool) -> Self {
        TOUCH_START_FORCE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TOUCH_START_FORCE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TOUCH_START_FORCE` writer - "]
pub struct TOUCH_START_FORCE_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUCH_START_FORCE_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 = "Field `TOUCH_START_EN` reader - "]
pub struct TOUCH_START_EN_R(crate::FieldReader<bool, bool>);
impl TOUCH_START_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        TOUCH_START_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TOUCH_START_EN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TOUCH_START_EN` writer - "]
pub struct TOUCH_START_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUCH_START_EN_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 = "Field `TOUCH_START_FSM_EN` reader - "]
pub struct TOUCH_START_FSM_EN_R(crate::FieldReader<bool, bool>);
impl TOUCH_START_FSM_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        TOUCH_START_FSM_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TOUCH_START_FSM_EN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TOUCH_START_FSM_EN` writer - "]
pub struct TOUCH_START_FSM_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUCH_START_FSM_EN_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 = "Field `TOUCH_MEAS_DONE` reader - "]
pub struct TOUCH_MEAS_DONE_R(crate::FieldReader<bool, bool>);
impl TOUCH_MEAS_DONE_R {
    pub(crate) fn new(bits: bool) -> Self {
        TOUCH_MEAS_DONE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TOUCH_MEAS_DONE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TOUCH_MEAS_DONE` writer - "]
pub struct TOUCH_MEAS_DONE_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUCH_MEAS_DONE_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 = "Field `TOUCH_MEAS_EN` reader - "]
pub struct TOUCH_MEAS_EN_R(crate::FieldReader<u16, u16>);
impl TOUCH_MEAS_EN_R {
    pub(crate) fn new(bits: u16) -> Self {
        TOUCH_MEAS_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TOUCH_MEAS_EN_R {
    type Target = crate::FieldReader<u16, u16>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TOUCH_MEAS_EN` writer - "]
pub struct TOUCH_MEAS_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> TOUCH_MEAS_EN_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 & !0x03ff) | ((value as u32) & 0x03ff);
        self.w
    }
}
impl R {
    #[doc = "Bit 30"]
    #[inline(always)]
    pub fn touch_meas_en_clr(&self) -> TOUCH_MEAS_EN_CLR_R {
        TOUCH_MEAS_EN_CLR_R::new(((self.bits >> 30) & 0x01) != 0)
    }
    #[doc = "Bits 14:29"]
    #[inline(always)]
    pub fn touch_sleep_cycles(&self) -> TOUCH_SLEEP_CYCLES_R {
        TOUCH_SLEEP_CYCLES_R::new(((self.bits >> 14) & 0xffff) as u16)
    }
    #[doc = "Bit 13"]
    #[inline(always)]
    pub fn touch_start_force(&self) -> TOUCH_START_FORCE_R {
        TOUCH_START_FORCE_R::new(((self.bits >> 13) & 0x01) != 0)
    }
    #[doc = "Bit 12"]
    #[inline(always)]
    pub fn touch_start_en(&self) -> TOUCH_START_EN_R {
        TOUCH_START_EN_R::new(((self.bits >> 12) & 0x01) != 0)
    }
    #[doc = "Bit 11"]
    #[inline(always)]
    pub fn touch_start_fsm_en(&self) -> TOUCH_START_FSM_EN_R {
        TOUCH_START_FSM_EN_R::new(((self.bits >> 11) & 0x01) != 0)
    }
    #[doc = "Bit 10"]
    #[inline(always)]
    pub fn touch_meas_done(&self) -> TOUCH_MEAS_DONE_R {
        TOUCH_MEAS_DONE_R::new(((self.bits >> 10) & 0x01) != 0)
    }
    #[doc = "Bits 0:9"]
    #[inline(always)]
    pub fn touch_meas_en(&self) -> TOUCH_MEAS_EN_R {
        TOUCH_MEAS_EN_R::new((self.bits & 0x03ff) as u16)
    }
}
impl W {
    #[doc = "Bit 30"]
    #[inline(always)]
    pub fn touch_meas_en_clr(&mut self) -> TOUCH_MEAS_EN_CLR_W {
        TOUCH_MEAS_EN_CLR_W { w: self }
    }
    #[doc = "Bits 14:29"]
    #[inline(always)]
    pub fn touch_sleep_cycles(&mut self) -> TOUCH_SLEEP_CYCLES_W {
        TOUCH_SLEEP_CYCLES_W { w: self }
    }
    #[doc = "Bit 13"]
    #[inline(always)]
    pub fn touch_start_force(&mut self) -> TOUCH_START_FORCE_W {
        TOUCH_START_FORCE_W { w: self }
    }
    #[doc = "Bit 12"]
    #[inline(always)]
    pub fn touch_start_en(&mut self) -> TOUCH_START_EN_W {
        TOUCH_START_EN_W { w: self }
    }
    #[doc = "Bit 11"]
    #[inline(always)]
    pub fn touch_start_fsm_en(&mut self) -> TOUCH_START_FSM_EN_W {
        TOUCH_START_FSM_EN_W { w: self }
    }
    #[doc = "Bit 10"]
    #[inline(always)]
    pub fn touch_meas_done(&mut self) -> TOUCH_MEAS_DONE_W {
        TOUCH_MEAS_DONE_W { w: self }
    }
    #[doc = "Bits 0:9"]
    #[inline(always)]
    pub fn touch_meas_en(&mut self) -> TOUCH_MEAS_EN_W {
        TOUCH_MEAS_EN_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 = "SENS_SAR_TOUCH_CTRL2\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 [sar_touch_ctrl2](index.html) module"]
pub struct SAR_TOUCH_CTRL2_SPEC;
impl crate::RegisterSpec for SAR_TOUCH_CTRL2_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [sar_touch_ctrl2::R](R) reader structure"]
impl crate::Readable for SAR_TOUCH_CTRL2_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [sar_touch_ctrl2::W](W) writer structure"]
impl crate::Writable for SAR_TOUCH_CTRL2_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets SAR_TOUCH_CTRL2 to value 0"]
impl crate::Resettable for SAR_TOUCH_CTRL2_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}