rusEFI
The most advanced open source ECU
can_filter.h
Go to the documentation of this file.
1 // can_filter.h
2 
3 #pragma once
4 
5 #define FILTER_SPECIFIC 0x1FFFFFFF
6 #define ANY_BUS -1
7 #define NO_CALLBACK -1
8 
9 struct CanFilter {
10  int32_t Id;
11  int32_t Mask;
12 
13  int Bus;
14  int Callback;
15 
16  bool accept(int p_Id) {
17  return (p_Id & this->Mask) == Id;
18  }
19 };
20 
21 // Called when the user script is unloaded, resets any CAN rx filters
22 void resetLuaCanRx();
23 // Adds a frame ID to listen to
24 void addLuaCanRxFilter(int32_t eid, uint32_t mask, int bus, int callback);
25 
26 CanFilter* getFilterForId(size_t busIndex, int Id);
void addLuaCanRxFilter(int32_t eid, uint32_t mask, int bus, int callback)
Definition: can_filter.cpp:29
void resetLuaCanRx()
Definition: can_filter.cpp:24
CanFilter * getFilterForId(size_t busIndex, int Id)
Definition: can_filter.cpp:10
int32_t Id
Definition: can_filter.h:10
int Callback
Definition: can_filter.h:14
int32_t Mask
Definition: can_filter.h:11
bool accept(int p_Id)
Definition: can_filter.h:16