rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
can.h File Reference

Detailed Description

Date
Mar 19, 2020
Author
Matthew Kennedy, (c) 2020

Definition in file can.h.

Data Structures

class  CanWrite
 
class  CanCycle
 

Typedefs

using CI = CanInterval
 

Enumerations

enum class  CanInterval : uint16_t {
  None = 0 , _5ms = 1 << 0 , _10ms = 1 << 1 , _20ms = 1 << 2 ,
  _50ms = 1 << 3 , _100ms = 1 << 4 , _200ms = 1 << 5 , _250ms = 1 << 6 ,
  _500ms = 1 << 7 , _1000ms = 1 << 8 , _MAX_Cycle = _1000ms
}
 

Functions

void resetCanWriteCycle ()
 
void processCanRxMessage (const size_t busIndex, const CANRxFrame &msg, efitick_t nowNt)
 
void registerCanListener (CanListener &listener)
 
void registerCanSensor (CanSensorBase &sensor)
 
constexpr CI operator| (CI lhs, CI rhs)
 
constexpr CI operator& (CI lhs, CI rhs)
 
constexpr CIoperator|= (CI &lhs, CI rhs)
 

Typedef Documentation

◆ CI

using CI = CanInterval

Definition at line 65 of file can.h.

Enumeration Type Documentation

◆ CanInterval

enum class CanInterval : uint16_t
strong
Enumerator
None 
_5ms 
_10ms 
_20ms 
_50ms 
_100ms 
_200ms 
_250ms 
_500ms 
_1000ms 
_MAX_Cycle 

Definition at line 29 of file can.h.

29 : uint16_t {
30 None = 0,
31 _5ms = 1 << 0,
32 _10ms = 1 << 1,
33 _20ms = 1 << 2,
34 _50ms = 1 << 3,
35 _100ms = 1 << 4,
36 _200ms = 1 << 5,
37 _250ms = 1 << 6,
38 _500ms = 1 << 7,
39 _1000ms = 1 << 8,
41};

Function Documentation

◆ operator&()

constexpr CI operator& ( CI  lhs,
CI  rhs 
)
constexpr

Definition at line 73 of file can.h.

73 {
74 using T = std::underlying_type_t<CI>;
75 return static_cast<CI>(static_cast<T>(lhs) & static_cast<T>(rhs));
76}
CanInterval
Definition can.h:29

◆ operator|()

constexpr CI operator| ( CI  lhs,
CI  rhs 
)
constexpr

Definition at line 68 of file can.h.

68 {
69 using T = std::underlying_type_t<CI>;
70 return static_cast<CI>(static_cast<T>(lhs) | static_cast<T>(rhs));
71}

◆ operator|=()

constexpr CI & operator|= ( CI lhs,
CI  rhs 
)
constexpr

Definition at line 78 of file can.h.

78 {
79 lhs = lhs | rhs;
80 return lhs;
81}

◆ processCanRxMessage()

void processCanRxMessage ( const size_t  busIndex,
const CANRxFrame msg,
efitick_t  nowNt 
)

Definition at line 203 of file can_rx.cpp.

203 {
204 if ((engineConfiguration->verboseCan && busIndex == 0) || verboseRxCan) {
205 printPacket(busIndex, frame);
206 } else if (engineConfiguration->verboseCan2 && busIndex == 1) {
207 printPacket(busIndex, frame);
208 }
209
210 if (custom_board_can_rx.has_value()) {
211 custom_board_can_rx.value()(busIndex, frame, nowNt);
212 }
213
214 // see AemXSeriesWideband as an example of CanSensorBase/CanListener
215 serviceCanSubscribers(busIndex, frame, nowNt);
216
217 // todo: convert to CanListener or not?
218 //Vss is configurable, should we handle it here:
219 processCanRxVss(frame, nowNt);
220
222 // todo: convert to CanListener or not?
223 processCanRxImu(frame);
224 }
225
226/*
227static Timer dashAliveTimer;
228
229 if (CAN_EID(frame) == (int)bench_test_packet_ids_e::DASH_ALIVE) {
230 // todo: add an indicator that dash is connected?
231 dashAliveTimer.reset();
232 }
233*/
234
237
238 processLuaCan(busIndex, frame);
239
240 {
241 obdOnCanPacketRx(frame, busIndex);
242 }
243
244#if EFI_ENGINE_CONTROL
245 if (CAN_EID(frame) == GDI4_BASE_ADDRESS && frame.data8[7] == GDI4_MAGIC) {
246// efiPrintf("CAN GDI4 says hi");
248 }
249#endif // EFI_ENGINE_CONTROL
250
251 handleWidebandCan(busIndex, frame);
252#if EFI_USE_OPENBLT
253#include "openblt/efi_blt_ids.h"
254 if ((CAN_SID(frame) == BOOT_COM_CAN_RX_MSG_ID) && (frame.DLC == 2)) {
255 /* TODO: gracefull shutdown? */
256 if (((busIndex == 0) && (engineConfiguration->canOpenBLT)) ||
257 ((busIndex == 1) && (engineConfiguration->can2OpenBLT))) {
259 }
260 }
261#endif
262}
void jump_to_openblt()
void processCanEcuControl(const CANRxFrame &frame)
void processCanQcBenchTest(const CANRxFrame &frame)
std::optional< board_can_rx_type > custom_board_can_rx
Definition can_rx.cpp:201
static void processCanRxImu(const CANRxFrame &frame)
Definition can_rx.cpp:160
static void printPacket(const size_t busIndex, const CANRxFrame &rx)
Definition can_rx.cpp:29
bool verboseRxCan
Definition settings.cpp:364
void serviceCanSubscribers(const size_t busIndex, const CANRxFrame &frame, efitick_t nowNt)
Definition can_rx.cpp:71
void processCanRxVss(const CANRxFrame &frame, efitick_t nowNt)
Definition can_vss.cpp:177
Timer externalGdiCanBusComms
LimpManager * getLimpManager()
Definition engine.cpp:596
static constexpr engine_configuration_s * engineConfiguration
void processLuaCan(const size_t busIndex, const CANRxFrame &frame)
void obdOnCanPacketRx(const CANRxFrame &rx, size_t busIndex)
Definition obd2.cpp:210
void handleWidebandCan(const size_t busIndex, const CANRxFrame &frame)
Here is the call graph for this function:

◆ registerCanListener()

void registerCanListener ( CanListener listener)

Definition at line 84 of file can_rx.cpp.

84 {
85 // If the listener already has a next, it's already registered
86 if (!listener.hasNext()) {
89 }
90}
CanListener * canListeners_head
Definition can_rx.cpp:69
bool hasNext() const
void setNext(CanListener *next)
static CanTsListener listener

Referenced by CanStreamer::init(), initCanGpioMsiobox(), and registerCanSensor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerCanSensor()

void registerCanSensor ( CanSensorBase sensor)

Definition at line 92 of file can_rx.cpp.

92 {
95}
void registerCanListener(CanListener &listener)
Definition can_rx.cpp:84
bool Register()
Definition sensor.cpp:131
static Lps25Sensor sensor(device)

Referenced by initCanSensors(), initEgt(), and initLambda().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetCanWriteCycle()

void resetCanWriteCycle ( )

Definition at line 45 of file can_tx.cpp.

45 {
46 m_cycleCount = 0;
47}
static uint16_t m_cycleCount
Definition can_tx.cpp:43

Go to the source code of this file.