1#[doc = "Register `PARAM` reader"]
2pub type R = crate::R<ParamSpec>;
3#[doc = "DAC Resolution\n\nValue on reset: 2"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6#[repr(u8)]
7pub enum DacRes {
8 #[doc = "0: 4-bit DAC"]
9 Reso4 = 0,
10 #[doc = "1: 6-bit DAC"]
11 Reso6 = 1,
12 #[doc = "2: 8-bit DAC"]
13 Reso8 = 2,
14 #[doc = "3: 10-bit DAC"]
15 Reso10 = 3,
16 #[doc = "4: 12-bit DAC"]
17 Reso12 = 4,
18 #[doc = "5: 14-bit DAC"]
19 Reso14 = 5,
20 #[doc = "6: 16-bit DAC"]
21 Reso16 = 6,
22}
23impl From<DacRes> for u8 {
24 #[inline(always)]
25 fn from(variant: DacRes) -> Self {
26 variant as _
27 }
28}
29impl crate::FieldSpec for DacRes {
30 type Ux = u8;
31}
32impl crate::IsEnum for DacRes {}
33#[doc = "Field `DAC_RES` reader - DAC Resolution"]
34pub type DacResR = crate::FieldReader<DacRes>;
35impl DacResR {
36 #[doc = "Get enumerated values variant"]
37 #[inline(always)]
38 pub const fn variant(&self) -> Option<DacRes> {
39 match self.bits {
40 0 => Some(DacRes::Reso4),
41 1 => Some(DacRes::Reso6),
42 2 => Some(DacRes::Reso8),
43 3 => Some(DacRes::Reso10),
44 4 => Some(DacRes::Reso12),
45 5 => Some(DacRes::Reso14),
46 6 => Some(DacRes::Reso16),
47 _ => None,
48 }
49 }
50 #[doc = "4-bit DAC"]
51 #[inline(always)]
52 pub fn is_reso_4(&self) -> bool {
53 *self == DacRes::Reso4
54 }
55 #[doc = "6-bit DAC"]
56 #[inline(always)]
57 pub fn is_reso_6(&self) -> bool {
58 *self == DacRes::Reso6
59 }
60 #[doc = "8-bit DAC"]
61 #[inline(always)]
62 pub fn is_reso_8(&self) -> bool {
63 *self == DacRes::Reso8
64 }
65 #[doc = "10-bit DAC"]
66 #[inline(always)]
67 pub fn is_reso_10(&self) -> bool {
68 *self == DacRes::Reso10
69 }
70 #[doc = "12-bit DAC"]
71 #[inline(always)]
72 pub fn is_reso_12(&self) -> bool {
73 *self == DacRes::Reso12
74 }
75 #[doc = "14-bit DAC"]
76 #[inline(always)]
77 pub fn is_reso_14(&self) -> bool {
78 *self == DacRes::Reso14
79 }
80 #[doc = "16-bit DAC"]
81 #[inline(always)]
82 pub fn is_reso_16(&self) -> bool {
83 *self == DacRes::Reso16
84 }
85}
86impl R {
87 #[doc = "Bits 0:3 - DAC Resolution"]
88 #[inline(always)]
89 pub fn dac_res(&self) -> DacResR {
90 DacResR::new((self.bits & 0x0f) as u8)
91 }
92}
93#[cfg(feature = "debug")]
94impl core::fmt::Debug for R {
95 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
96 f.debug_struct("PARAM").field("dac_res", &self.dac_res()).finish()
97 }
98}
99#[doc = "Parameter\n\nYou can [`read`](crate::Reg::read) this register and get [`param::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
100pub struct ParamSpec;
101impl crate::RegisterSpec for ParamSpec {
102 type Ux = u32;
103}
104#[doc = "`read()` method returns [`param::R`](R) reader structure"]
105impl crate::Readable for ParamSpec {}
106#[doc = "`reset()` method sets PARAM to value 0x02"]
107impl crate::Resettable for ParamSpec {
108 const RESET_VALUE: u32 = 0x02;
109}