esp32c6/twai0/
err_code_cap.rs

1#[doc = "Register `ERR_CODE_CAP` reader"]
2pub type R = crate::R<ERR_CODE_CAP_SPEC>;
3#[doc = "Field `ERR_CAPTURE_CODE_SEGMENT` reader - This register contains information about the location of errors on the bus."]
4pub type ERR_CAPTURE_CODE_SEGMENT_R = crate::FieldReader;
5#[doc = "Field `ECC_DIRECTION` reader - 1: RX, error occurred during reception. 0: TX, error occurred during transmission."]
6pub type ECC_DIRECTION_R = crate::BitReader;
7#[doc = "Field `ERR_CAPTURE_CODE_TYPE` reader - 00: bit error. 01: form error. 10:stuff error. 11:other type of error."]
8pub type ERR_CAPTURE_CODE_TYPE_R = crate::FieldReader;
9impl R {
10    #[doc = "Bits 0:4 - This register contains information about the location of errors on the bus."]
11    #[inline(always)]
12    pub fn err_capture_code_segment(&self) -> ERR_CAPTURE_CODE_SEGMENT_R {
13        ERR_CAPTURE_CODE_SEGMENT_R::new((self.bits & 0x1f) as u8)
14    }
15    #[doc = "Bit 5 - 1: RX, error occurred during reception. 0: TX, error occurred during transmission."]
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 - 00: bit error. 01: form error. 10:stuff error. 11:other type of error."]
21    #[inline(always)]
22    pub fn err_capture_code_type(&self) -> ERR_CAPTURE_CODE_TYPE_R {
23        ERR_CAPTURE_CODE_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("err_capture_code_segment", &self.err_capture_code_segment())
31            .field("ecc_direction", &self.ecc_direction())
32            .field("err_capture_code_type", &self.err_capture_code_type())
33            .finish()
34    }
35}
36#[doc = "TWAI error info 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}