Line |
Branch |
Decision |
Exec |
Source |
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 |
|
|
9 |
bool accept(int p_Id) { |
17 |
|
|
9 |
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); |
27 |
|
|
|
|