1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
///Register `NBTP` reader
pub type R = crate::R<NBTPrs>;
///Register `NBTP` writer
pub type W = crate::W<NBTPrs>;
///Field `NTSEG2` reader - Nominal Time segment after sample point
pub type NTSEG2_R = crate::FieldReader;
///Field `NTSEG2` writer - Nominal Time segment after sample point
pub type NTSEG2_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
///Field `NTSEG1` reader - Nominal Time segment before sample point
pub type NTSEG1_R = crate::FieldReader;
///Field `NTSEG1` writer - Nominal Time segment before sample point
pub type NTSEG1_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
///Field `NBRP` reader - Bit Rate Prescaler
pub type NBRP_R = crate::FieldReader<u16>;
///Field `NBRP` writer - Bit Rate Prescaler
pub type NBRP_W<'a, REG> = crate::FieldWriter<'a, REG, 9, u16>;
///Field `NSJW` reader - NSJW: Nominal (Re)Synchronization Jump Width
pub type NSJW_R = crate::FieldReader;
///Field `NSJW` writer - NSJW: Nominal (Re)Synchronization Jump Width
pub type NSJW_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
impl R {
///Bits 0:6 - Nominal Time segment after sample point
#[inline(always)]
pub fn ntseg2(&self) -> NTSEG2_R {
NTSEG2_R::new((self.bits & 0x7f) as u8)
}
///Bits 8:15 - Nominal Time segment before sample point
#[inline(always)]
pub fn ntseg1(&self) -> NTSEG1_R {
NTSEG1_R::new(((self.bits >> 8) & 0xff) as u8)
}
///Bits 16:24 - Bit Rate Prescaler
#[inline(always)]
pub fn nbrp(&self) -> NBRP_R {
NBRP_R::new(((self.bits >> 16) & 0x01ff) as u16)
}
///Bits 25:31 - NSJW: Nominal (Re)Synchronization Jump Width
#[inline(always)]
pub fn nsjw(&self) -> NSJW_R {
NSJW_R::new(((self.bits >> 25) & 0x7f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("NBTP")
.field("nsjw", &self.nsjw())
.field("nbrp", &self.nbrp())
.field("ntseg1", &self.ntseg1())
.field("ntseg2", &self.ntseg2())
.finish()
}
}
impl W {
///Bits 0:6 - Nominal Time segment after sample point
#[inline(always)]
pub fn ntseg2(&mut self) -> NTSEG2_W<NBTPrs> {
NTSEG2_W::new(self, 0)
}
///Bits 8:15 - Nominal Time segment before sample point
#[inline(always)]
pub fn ntseg1(&mut self) -> NTSEG1_W<NBTPrs> {
NTSEG1_W::new(self, 8)
}
///Bits 16:24 - Bit Rate Prescaler
#[inline(always)]
pub fn nbrp(&mut self) -> NBRP_W<NBTPrs> {
NBRP_W::new(self, 16)
}
///Bits 25:31 - NSJW: Nominal (Re)Synchronization Jump Width
#[inline(always)]
pub fn nsjw(&mut self) -> NSJW_W<NBTPrs> {
NSJW_W::new(self, 25)
}
}
/**FDCAN Nominal Bit Timing and Prescaler Register
You can [`read`](crate::Reg::read) this register and get [`nbtp::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`nbtp::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).*/
pub struct NBTPrs;
impl crate::RegisterSpec for NBTPrs {
type Ux = u32;
}
///`read()` method returns [`nbtp::R`](R) reader structure
impl crate::Readable for NBTPrs {}
///`write(|w| ..)` method takes [`nbtp::W`](W) writer structure
impl crate::Writable for NBTPrs {
type Safety = crate::Unsafe;
}
///`reset()` method sets NBTP to value 0
impl crate::Resettable for NBTPrs {}