1#[doc = "Register `ADDR%s` reader"]
2pub struct R(crate::R<ADDR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ADDR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ADDR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ADDR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `DATA` reader - A/D conversion data"]
17pub type DATA_R = crate::FieldReader<u16, u16>;
18#[doc = "Field `ERR` reader - A/D conversion data error status"]
19pub type ERR_R = crate::BitReader<ERR_A>;
20#[doc = "A/D conversion data error status\n\nValue on reset: 0"]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22pub enum ERR_A {
23 #[doc = "0: No error (the A/D conversion data is valid)"]
24 _0 = 0,
25 #[doc = "1: Error is detected (the A/D conversion data is not guaranteed)"]
26 _1 = 1,
27}
28impl From<ERR_A> for bool {
29 #[inline(always)]
30 fn from(variant: ERR_A) -> Self {
31 variant as u8 != 0
32 }
33}
34impl ERR_R {
35 #[doc = "Get enumerated values variant"]
36 #[inline(always)]
37 pub fn variant(&self) -> ERR_A {
38 match self.bits {
39 false => ERR_A::_0,
40 true => ERR_A::_1,
41 }
42 }
43 #[doc = "Checks if the value of the field is `_0`"]
44 #[inline(always)]
45 pub fn is_0(&self) -> bool {
46 *self == ERR_A::_0
47 }
48 #[doc = "Checks if the value of the field is `_1`"]
49 #[inline(always)]
50 pub fn is_1(&self) -> bool {
51 *self == ERR_A::_1
52 }
53}
54impl R {
55 #[doc = "Bits 0:15 - A/D conversion data"]
56 #[inline(always)]
57 pub fn data(&self) -> DATA_R {
58 DATA_R::new((self.bits & 0xffff) as u16)
59 }
60 #[doc = "Bit 31 - A/D conversion data error status"]
61 #[inline(always)]
62 pub fn err(&self) -> ERR_R {
63 ERR_R::new(((self.bits >> 31) & 1) != 0)
64 }
65}
66#[doc = "A/D Data Register %s\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [addr](index.html) module"]
67pub struct ADDR_SPEC;
68impl crate::RegisterSpec for ADDR_SPEC {
69 type Ux = u32;
70}
71#[doc = "`read()` method returns [addr::R](R) reader structure"]
72impl crate::Readable for ADDR_SPEC {
73 type Reader = R;
74}
75#[doc = "`reset()` method sets ADDR%s to value 0"]
76impl crate::Resettable for ADDR_SPEC {
77 const RESET_VALUE: Self::Ux = 0;
78}