Module eco_can

Module eco_can 

Source
Expand description

Contains structs for CAN packages

§CAN Package Information

A CAN package is setup like this:

#[allow(non_camel_case_types)]
#[derive(bincode::Encode, bincode::Decode, PartialEq, Clone, Debug, Format, Default)]
#[repr(C)]
pub struct FDCAN_PACKAGE_NAME {
    // Package Data
}
impl FDCANPack for FDCAN_FetPack_t {
   const FDCAN_BYTES: FDCANLength = BYTE_LENGTH; // set this to the size of the package in bytes
   const FDCAN_ID: u32 = CAN_ID;    // the ID of the CAN package
}

#[allow(non_camel_case_types)] allows non-camel-case names for FDCAN packages

#[derive(bincode::Encode, bincode::Decode)] makes the package able to be encoded to and decoded from bytes.

#[derive(Clone)] allows the package to be copied.

#[derive(Debug)] allows the package to be formatted in log messages.

#[derive(Default)] allows the package to be inialized with default variables (usually 0).

#[repr(C)] Make Rust use the same memory layout for this struct as C to ensure compatility. For more information: https://doc.rust-lang.org/nomicon/other-reprs.html

Structs§

ECOCAN_H2Pack1_t
ECOCAN_H2Pack2_t
ECOCAN_H2_ARM_ALARM_t
ECOCAN_RelPackChrg_t
FDCAN_BATTPack2_t
FDCAN_BOOSTPack1_t
FDCAN_BOOSTPack2_t
FDCAN_BOOSTPack3_t
FDCAN_FccPack1_t
FDCAN_FccPack2_t
FDCAN_FccPack3_t
FDCAN_FetPack_t
FDCAN_RelPackCap_t
FDCAN_RelPackFc_t
FDCAN_RelPackMtr_t
FDCAN_RelPackNrg_t

Enums§

FDCANLength
The length of the package in bytes, can be up to 64 bytes.
FetBit
Bit Definitions for FET State
FetState
FET States
RelayBit
Bit Definitions for REL Board State
RelayState
Relay Board State

Constants§

FDCAN_H2ALARM_ID
1 indicates tripped alarm
FDCAN_SYNCLED_ID
1 indicates led on

Traits§

FDCANPack
Prerequisite trait for FDCAN Packages