1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#[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 From<crate::R<SAR_TOUCH_CTRL2_SPEC>> for R {
    #[inline(always)]
    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 From<crate::W<SAR_TOUCH_CTRL2_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<SAR_TOUCH_CTRL2_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `TOUCH_MEAS_EN` reader - 10-bit register to indicate which pads are \"touched\""]
pub type TOUCH_MEAS_EN_R = crate::FieldReader<u16, u16>;
#[doc = "Field `TOUCH_MEAS_DONE` reader - fsm set 1 to indicate touch touch meas is done"]
pub type TOUCH_MEAS_DONE_R = crate::BitReader<bool>;
#[doc = "Field `TOUCH_START_FSM_EN` reader - 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm 0: TOUCH_START & TOUCH_XPD is controlled by registers"]
pub type TOUCH_START_FSM_EN_R = crate::BitReader<bool>;
#[doc = "Field `TOUCH_START_FSM_EN` writer - 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm 0: TOUCH_START & TOUCH_XPD is controlled by registers"]
pub type TOUCH_START_FSM_EN_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, SAR_TOUCH_CTRL2_SPEC, bool, O>;
#[doc = "Field `TOUCH_START_EN` reader - 1: start touch fsm valid when reg_touch_start_force is set"]
pub type TOUCH_START_EN_R = crate::BitReader<bool>;
#[doc = "Field `TOUCH_START_EN` writer - 1: start touch fsm valid when reg_touch_start_force is set"]
pub type TOUCH_START_EN_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, SAR_TOUCH_CTRL2_SPEC, bool, O>;
#[doc = "Field `TOUCH_START_FORCE` reader - 1: to start touch fsm by SW 0: to start touch fsm by timer"]
pub type TOUCH_START_FORCE_R = crate::BitReader<bool>;
#[doc = "Field `TOUCH_START_FORCE` writer - 1: to start touch fsm by SW 0: to start touch fsm by timer"]
pub type TOUCH_START_FORCE_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, SAR_TOUCH_CTRL2_SPEC, bool, O>;
#[doc = "Field `TOUCH_SLEEP_CYCLES` reader - sleep cycles for timer"]
pub type TOUCH_SLEEP_CYCLES_R = crate::FieldReader<u16, u16>;
#[doc = "Field `TOUCH_SLEEP_CYCLES` writer - sleep cycles for timer"]
pub type TOUCH_SLEEP_CYCLES_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, SAR_TOUCH_CTRL2_SPEC, u16, u16, 16, O>;
#[doc = "Field `TOUCH_MEAS_EN_CLR` writer - to clear reg_touch_meas_en"]
pub type TOUCH_MEAS_EN_CLR_W<'a, const O: u8> =
    crate::BitWriter<'a, u32, SAR_TOUCH_CTRL2_SPEC, bool, O>;
impl R {
    #[doc = "Bits 0:9 - 10-bit register to indicate which pads are \"touched\""]
    #[inline(always)]
    pub fn touch_meas_en(&self) -> TOUCH_MEAS_EN_R {
        TOUCH_MEAS_EN_R::new((self.bits & 0x03ff) as u16)
    }
    #[doc = "Bit 10 - fsm set 1 to indicate touch touch meas is done"]
    #[inline(always)]
    pub fn touch_meas_done(&self) -> TOUCH_MEAS_DONE_R {
        TOUCH_MEAS_DONE_R::new(((self.bits >> 10) & 1) != 0)
    }
    #[doc = "Bit 11 - 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm 0: TOUCH_START & TOUCH_XPD is controlled by registers"]
    #[inline(always)]
    pub fn touch_start_fsm_en(&self) -> TOUCH_START_FSM_EN_R {
        TOUCH_START_FSM_EN_R::new(((self.bits >> 11) & 1) != 0)
    }
    #[doc = "Bit 12 - 1: start touch fsm valid when reg_touch_start_force is set"]
    #[inline(always)]
    pub fn touch_start_en(&self) -> TOUCH_START_EN_R {
        TOUCH_START_EN_R::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bit 13 - 1: to start touch fsm by SW 0: to start touch fsm by timer"]
    #[inline(always)]
    pub fn touch_start_force(&self) -> TOUCH_START_FORCE_R {
        TOUCH_START_FORCE_R::new(((self.bits >> 13) & 1) != 0)
    }
    #[doc = "Bits 14:29 - sleep cycles for timer"]
    #[inline(always)]
    pub fn touch_sleep_cycles(&self) -> TOUCH_SLEEP_CYCLES_R {
        TOUCH_SLEEP_CYCLES_R::new(((self.bits >> 14) & 0xffff) as u16)
    }
}
impl W {
    #[doc = "Bit 11 - 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm 0: TOUCH_START & TOUCH_XPD is controlled by registers"]
    #[inline(always)]
    #[must_use]
    pub fn touch_start_fsm_en(&mut self) -> TOUCH_START_FSM_EN_W<11> {
        TOUCH_START_FSM_EN_W::new(self)
    }
    #[doc = "Bit 12 - 1: start touch fsm valid when reg_touch_start_force is set"]
    #[inline(always)]
    #[must_use]
    pub fn touch_start_en(&mut self) -> TOUCH_START_EN_W<12> {
        TOUCH_START_EN_W::new(self)
    }
    #[doc = "Bit 13 - 1: to start touch fsm by SW 0: to start touch fsm by timer"]
    #[inline(always)]
    #[must_use]
    pub fn touch_start_force(&mut self) -> TOUCH_START_FORCE_W<13> {
        TOUCH_START_FORCE_W::new(self)
    }
    #[doc = "Bits 14:29 - sleep cycles for timer"]
    #[inline(always)]
    #[must_use]
    pub fn touch_sleep_cycles(&mut self) -> TOUCH_SLEEP_CYCLES_W<14> {
        TOUCH_SLEEP_CYCLES_W::new(self)
    }
    #[doc = "Bit 30 - to clear reg_touch_meas_en"]
    #[inline(always)]
    #[must_use]
    pub fn touch_meas_en_clr(&mut self) -> TOUCH_MEAS_EN_CLR_W<30> {
        TOUCH_MEAS_EN_CLR_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "\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;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets SAR_TOUCH_CTRL2 to value 0x0040_0800"]
impl crate::Resettable for SAR_TOUCH_CTRL2_SPEC {
    const RESET_VALUE: Self::Ux = 0x0040_0800;
}