esp32s3/twai0/
err_code_cap.rs

1#[doc = "Register `ERR_CODE_CAP` reader"]
2pub type R = crate::R<ERR_CODE_CAP_SPEC>;
3#[doc = "Field `ECC_SEGMENT` reader - This register contains information about the location of errors, see Table 181 for details."]
4pub type ECC_SEGMENT_R = crate::FieldReader;
5#[doc = "Field `ECC_DIRECTION` reader - This register contains information about transmission direction of the node when error occurs. 1: Error occurs when receiving a message; 0: Error occurs when transmitting a message"]
6pub type ECC_DIRECTION_R = crate::BitReader;
7#[doc = "Field `ECC_TYPE` reader - This register contains information about error types: 00: bit error; 01: form error; 10: stuff error; 11: other type of error"]
8pub type ECC_TYPE_R = crate::FieldReader;
9impl R {
10    #[doc = "Bits 0:4 - This register contains information about the location of errors, see Table 181 for details."]
11    #[inline(always)]
12    pub fn ecc_segment(&self) -> ECC_SEGMENT_R {
13        ECC_SEGMENT_R::new((self.bits & 0x1f) as u8)
14    }
15    #[doc = "Bit 5 - This register contains information about transmission direction of the node when error occurs. 1: Error occurs when receiving a message; 0: Error occurs when transmitting a message"]
16    #[inline(always)]
17    pub fn ecc_direction(&self) -> ECC_DIRECTION_R {
18        ECC_DIRECTION_R::new(((self.bits >> 5) & 1) != 0)
19    }
20    #[doc = "Bits 6:7 - This register contains information about error types: 00: bit error; 01: form error; 10: stuff error; 11: other type of error"]
21    #[inline(always)]
22    pub fn ecc_type(&self) -> ECC_TYPE_R {
23        ECC_TYPE_R::new(((self.bits >> 6) & 3) as u8)
24    }
25}
26#[cfg(feature = "impl-register-debug")]
27impl core::fmt::Debug for R {
28    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
29        f.debug_struct("ERR_CODE_CAP")
30            .field("ecc_segment", &self.ecc_segment())
31            .field("ecc_direction", &self.ecc_direction())
32            .field("ecc_type", &self.ecc_type())
33            .finish()
34    }
35}
36#[doc = "Error Code Capture Register\n\nYou can [`read`](crate::Reg::read) this register and get [`err_code_cap::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
37pub struct ERR_CODE_CAP_SPEC;
38impl crate::RegisterSpec for ERR_CODE_CAP_SPEC {
39    type Ux = u32;
40}
41#[doc = "`read()` method returns [`err_code_cap::R`](R) reader structure"]
42impl crate::Readable for ERR_CODE_CAP_SPEC {}
43#[doc = "`reset()` method sets ERR_CODE_CAP to value 0"]
44impl crate::Resettable for ERR_CODE_CAP_SPEC {
45    const RESET_VALUE: u32 = 0;
46}