ht32f2yyy/ht32f275x/mctm/
mctm_ch0icfr.rs1#[doc = "Reader of register MCTM_CH0ICFR"]
2pub type R = crate::R<u32, super::MCTM_CH0ICFR>;
3#[doc = "Writer for register MCTM_CH0ICFR"]
4pub type W = crate::W<u32, super::MCTM_CH0ICFR>;
5#[doc = "Register MCTM_CH0ICFR `reset()`'s with value 0"]
6impl crate::ResetValue for super::MCTM_CH0ICFR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `TI0F`"]
14pub type TI0F_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `TI0F`"]
16pub struct TI0F_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> TI0F_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
24 self.w
25 }
26}
27#[doc = "Reader of field `CH0CCS`"]
28pub type CH0CCS_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `CH0CCS`"]
30pub struct CH0CCS_W<'a> {
31 w: &'a mut W,
32}
33impl<'a> CH0CCS_W<'a> {
34 #[doc = r"Writes raw bits to the field"]
35 #[inline(always)]
36 pub unsafe fn bits(self, value: u8) -> &'a mut W {
37 self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
38 self.w
39 }
40}
41#[doc = "Reader of field `CH0PSC`"]
42pub type CH0PSC_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `CH0PSC`"]
44pub struct CH0PSC_W<'a> {
45 w: &'a mut W,
46}
47impl<'a> CH0PSC_W<'a> {
48 #[doc = r"Writes raw bits to the field"]
49 #[inline(always)]
50 pub unsafe fn bits(self, value: u8) -> &'a mut W {
51 self.w.bits = (self.w.bits & !(0x03 << 18)) | (((value as u32) & 0x03) << 18);
52 self.w
53 }
54}
55#[doc = "Reader of field `TI0SRC`"]
56pub type TI0SRC_R = crate::R<bool, bool>;
57#[doc = "Write proxy for field `TI0SRC`"]
58pub struct TI0SRC_W<'a> {
59 w: &'a mut W,
60}
61impl<'a> TI0SRC_W<'a> {
62 #[doc = r"Sets the field bit"]
63 #[inline(always)]
64 pub fn set_bit(self) -> &'a mut W {
65 self.bit(true)
66 }
67 #[doc = r"Clears the field bit"]
68 #[inline(always)]
69 pub fn clear_bit(self) -> &'a mut W {
70 self.bit(false)
71 }
72 #[doc = r"Writes raw bits to the field"]
73 #[inline(always)]
74 pub fn bit(self, value: bool) -> &'a mut W {
75 self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
76 self.w
77 }
78}
79impl R {
80 #[doc = "Bits 0:3 - TI0F"]
81 #[inline(always)]
82 pub fn ti0f(&self) -> TI0F_R {
83 TI0F_R::new((self.bits & 0x0f) as u8)
84 }
85 #[doc = "Bits 16:17 - CH0CCS"]
86 #[inline(always)]
87 pub fn ch0ccs(&self) -> CH0CCS_R {
88 CH0CCS_R::new(((self.bits >> 16) & 0x03) as u8)
89 }
90 #[doc = "Bits 18:19 - CH0PSC"]
91 #[inline(always)]
92 pub fn ch0psc(&self) -> CH0PSC_R {
93 CH0PSC_R::new(((self.bits >> 18) & 0x03) as u8)
94 }
95 #[doc = "Bit 31 - TI0SRC"]
96 #[inline(always)]
97 pub fn ti0src(&self) -> TI0SRC_R {
98 TI0SRC_R::new(((self.bits >> 31) & 0x01) != 0)
99 }
100}
101impl W {
102 #[doc = "Bits 0:3 - TI0F"]
103 #[inline(always)]
104 pub fn ti0f(&mut self) -> TI0F_W {
105 TI0F_W { w: self }
106 }
107 #[doc = "Bits 16:17 - CH0CCS"]
108 #[inline(always)]
109 pub fn ch0ccs(&mut self) -> CH0CCS_W {
110 CH0CCS_W { w: self }
111 }
112 #[doc = "Bits 18:19 - CH0PSC"]
113 #[inline(always)]
114 pub fn ch0psc(&mut self) -> CH0PSC_W {
115 CH0PSC_W { w: self }
116 }
117 #[doc = "Bit 31 - TI0SRC"]
118 #[inline(always)]
119 pub fn ti0src(&mut self) -> TI0SRC_W {
120 TI0SRC_W { w: self }
121 }
122}