eos_s3/adc/
adc_status.rs

1#[doc = "Register `ADC_Status` reader"]
2pub struct R(crate::R<ADC_STATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ADC_STATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ADC_STATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ADC_STATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "End of Conversion. Rises when data is valid\n\nValue on reset: 0"]
17#[derive(Clone, Copy, Debug, PartialEq)]
18pub enum EOC_A {
19    #[doc = "0: data in OUT field is not valid"]
20    NON_VALID = 0,
21    #[doc = "1: data in OUT field is valid"]
22    VALID = 1,
23}
24impl From<EOC_A> for bool {
25    #[inline(always)]
26    fn from(variant: EOC_A) -> Self {
27        variant as u8 != 0
28    }
29}
30#[doc = "Field `EOC` reader - End of Conversion. Rises when data is valid"]
31pub struct EOC_R(crate::FieldReader<bool, EOC_A>);
32impl EOC_R {
33    #[inline(always)]
34    pub(crate) fn new(bits: bool) -> Self {
35        EOC_R(crate::FieldReader::new(bits))
36    }
37    #[doc = r"Get enumerated values variant"]
38    #[inline(always)]
39    pub fn variant(&self) -> EOC_A {
40        match self.bits {
41            false => EOC_A::NON_VALID,
42            true => EOC_A::VALID,
43        }
44    }
45    #[doc = "Checks if the value of the field is `NON_VALID`"]
46    #[inline(always)]
47    pub fn is_non_valid(&self) -> bool {
48        **self == EOC_A::NON_VALID
49    }
50    #[doc = "Checks if the value of the field is `VALID`"]
51    #[inline(always)]
52    pub fn is_valid(&self) -> bool {
53        **self == EOC_A::VALID
54    }
55}
56impl core::ops::Deref for EOC_R {
57    type Target = crate::FieldReader<bool, EOC_A>;
58    #[inline(always)]
59    fn deref(&self) -> &Self::Target {
60        &self.0
61    }
62}
63impl R {
64    #[doc = "Bit 0 - End of Conversion. Rises when data is valid"]
65    #[inline(always)]
66    pub fn eoc(&self) -> EOC_R {
67        EOC_R::new((self.bits & 0x01) != 0)
68    }
69}
70#[doc = "Status\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 [adc_status](index.html) module"]
71pub struct ADC_STATUS_SPEC;
72impl crate::RegisterSpec for ADC_STATUS_SPEC {
73    type Ux = u32;
74}
75#[doc = "`read()` method returns [adc_status::R](R) reader structure"]
76impl crate::Readable for ADC_STATUS_SPEC {
77    type Reader = R;
78}
79#[doc = "`reset()` method sets ADC_Status to value 0"]
80impl crate::Resettable for ADC_STATUS_SPEC {
81    #[inline(always)]
82    fn reset_value() -> Self::Ux {
83        0
84    }
85}