xmc4300/can/
list.rs

1#[doc = "Register `LIST[%s]` reader"]
2pub type R = crate::R<LIST_SPEC>;
3#[doc = "Field `BEGIN` reader - List Begin"]
4pub type BEGIN_R = crate::FieldReader;
5#[doc = "Field `END` reader - List End"]
6pub type END_R = crate::FieldReader;
7#[doc = "Field `SIZE` reader - List Size"]
8pub type SIZE_R = crate::FieldReader;
9#[doc = "List Empty Indication\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum EMPTY_A {
12    #[doc = "0: At least one message object is allocated to list i."]
13    VALUE1 = 0,
14    #[doc = "1: No message object is allocated to the list i. List i is empty."]
15    VALUE2 = 1,
16}
17impl From<EMPTY_A> for bool {
18    #[inline(always)]
19    fn from(variant: EMPTY_A) -> Self {
20        variant as u8 != 0
21    }
22}
23#[doc = "Field `EMPTY` reader - List Empty Indication"]
24pub type EMPTY_R = crate::BitReader<EMPTY_A>;
25impl EMPTY_R {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> EMPTY_A {
29        match self.bits {
30            false => EMPTY_A::VALUE1,
31            true => EMPTY_A::VALUE2,
32        }
33    }
34    #[doc = "At least one message object is allocated to list i."]
35    #[inline(always)]
36    pub fn is_value1(&self) -> bool {
37        *self == EMPTY_A::VALUE1
38    }
39    #[doc = "No message object is allocated to the list i. List i is empty."]
40    #[inline(always)]
41    pub fn is_value2(&self) -> bool {
42        *self == EMPTY_A::VALUE2
43    }
44}
45impl R {
46    #[doc = "Bits 0:7 - List Begin"]
47    #[inline(always)]
48    pub fn begin(&self) -> BEGIN_R {
49        BEGIN_R::new((self.bits & 0xff) as u8)
50    }
51    #[doc = "Bits 8:15 - List End"]
52    #[inline(always)]
53    pub fn end(&self) -> END_R {
54        END_R::new(((self.bits >> 8) & 0xff) as u8)
55    }
56    #[doc = "Bits 16:23 - List Size"]
57    #[inline(always)]
58    pub fn size(&self) -> SIZE_R {
59        SIZE_R::new(((self.bits >> 16) & 0xff) as u8)
60    }
61    #[doc = "Bit 24 - List Empty Indication"]
62    #[inline(always)]
63    pub fn empty(&self) -> EMPTY_R {
64        EMPTY_R::new(((self.bits >> 24) & 1) != 0)
65    }
66}
67#[doc = "List Register\n\nYou can [`read`](crate::Reg::read) this register and get [`list::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
68pub struct LIST_SPEC;
69impl crate::RegisterSpec for LIST_SPEC {
70    type Ux = u32;
71}
72#[doc = "`read()` method returns [`list::R`](R) reader structure"]
73impl crate::Readable for LIST_SPEC {}
74#[doc = "`reset()` method sets LIST[%s]
75to value 0"]
76impl crate::Resettable for LIST_SPEC {
77    const RESET_VALUE: u32 = 0;
78}