xmc4500/can_node0/
npcr.rs1#[doc = "Register `NPCR` reader"]
2pub type R = crate::R<NPCR_SPEC>;
3#[doc = "Register `NPCR` writer"]
4pub type W = crate::W<NPCR_SPEC>;
5#[doc = "Field `RXSEL` reader - Receive Select"]
6pub type RXSEL_R = crate::FieldReader;
7#[doc = "Field `RXSEL` writer - Receive Select"]
8pub type RXSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
9#[doc = "Loop-Back Mode\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum LBM_A {
12 #[doc = "0: Loop-Back Mode is disabled."]
13 VALUE1 = 0,
14 #[doc = "1: Loop-Back Mode is enabled. This node is connected to an internal (virtual) loop-back CAN bus. All CAN nodes which are in Loop-Back Mode are connected to this virtual CAN bus so that they can communicate with each other internally. The external transmit line is forced recessive in Loop-Back Mode."]
15 VALUE2 = 1,
16}
17impl From<LBM_A> for bool {
18 #[inline(always)]
19 fn from(variant: LBM_A) -> Self {
20 variant as u8 != 0
21 }
22}
23#[doc = "Field `LBM` reader - Loop-Back Mode"]
24pub type LBM_R = crate::BitReader<LBM_A>;
25impl LBM_R {
26 #[doc = "Get enumerated values variant"]
27 #[inline(always)]
28 pub const fn variant(&self) -> LBM_A {
29 match self.bits {
30 false => LBM_A::VALUE1,
31 true => LBM_A::VALUE2,
32 }
33 }
34 #[doc = "Loop-Back Mode is disabled."]
35 #[inline(always)]
36 pub fn is_value1(&self) -> bool {
37 *self == LBM_A::VALUE1
38 }
39 #[doc = "Loop-Back Mode is enabled. This node is connected to an internal (virtual) loop-back CAN bus. All CAN nodes which are in Loop-Back Mode are connected to this virtual CAN bus so that they can communicate with each other internally. The external transmit line is forced recessive in Loop-Back Mode."]
40 #[inline(always)]
41 pub fn is_value2(&self) -> bool {
42 *self == LBM_A::VALUE2
43 }
44}
45#[doc = "Field `LBM` writer - Loop-Back Mode"]
46pub type LBM_W<'a, REG> = crate::BitWriter<'a, REG, LBM_A>;
47impl<'a, REG> LBM_W<'a, REG>
48where
49 REG: crate::Writable + crate::RegisterSpec,
50{
51 #[doc = "Loop-Back Mode is disabled."]
52 #[inline(always)]
53 pub fn value1(self) -> &'a mut crate::W<REG> {
54 self.variant(LBM_A::VALUE1)
55 }
56 #[doc = "Loop-Back Mode is enabled. This node is connected to an internal (virtual) loop-back CAN bus. All CAN nodes which are in Loop-Back Mode are connected to this virtual CAN bus so that they can communicate with each other internally. The external transmit line is forced recessive in Loop-Back Mode."]
57 #[inline(always)]
58 pub fn value2(self) -> &'a mut crate::W<REG> {
59 self.variant(LBM_A::VALUE2)
60 }
61}
62impl R {
63 #[doc = "Bits 0:2 - Receive Select"]
64 #[inline(always)]
65 pub fn rxsel(&self) -> RXSEL_R {
66 RXSEL_R::new((self.bits & 7) as u8)
67 }
68 #[doc = "Bit 8 - Loop-Back Mode"]
69 #[inline(always)]
70 pub fn lbm(&self) -> LBM_R {
71 LBM_R::new(((self.bits >> 8) & 1) != 0)
72 }
73}
74impl W {
75 #[doc = "Bits 0:2 - Receive Select"]
76 #[inline(always)]
77 pub fn rxsel(&mut self) -> RXSEL_W<NPCR_SPEC> {
78 RXSEL_W::new(self, 0)
79 }
80 #[doc = "Bit 8 - Loop-Back Mode"]
81 #[inline(always)]
82 pub fn lbm(&mut self) -> LBM_W<NPCR_SPEC> {
83 LBM_W::new(self, 8)
84 }
85}
86#[doc = "Node Port Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`npcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`npcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
87pub struct NPCR_SPEC;
88impl crate::RegisterSpec for NPCR_SPEC {
89 type Ux = u32;
90}
91#[doc = "`read()` method returns [`npcr::R`](R) reader structure"]
92impl crate::Readable for NPCR_SPEC {}
93#[doc = "`write(|w| ..)` method takes [`npcr::W`](W) writer structure"]
94impl crate::Writable for NPCR_SPEC {
95 type Safety = crate::Unsafe;
96 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
97 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
98}
99#[doc = "`reset()` method sets NPCR to value 0"]
100impl crate::Resettable for NPCR_SPEC {
101 const RESET_VALUE: u32 = 0;
102}