-
Notifications
You must be signed in to change notification settings - Fork 0
/
c_can_bridge.h
35 lines (31 loc) · 1.04 KB
/
c_can_bridge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdlib.h>
#include "canopenlib_linux_hw.h"
extern "C"
{
/*
* Scala callback when a message is received
*/
typedef void (*msgReceived) (int port,
long long id,
int dlc,
int flags,
void *msg);
//receive messages thread
void *readMsgFunction (void *__port);
//Initialize all the Library structures
void initLibrary();
//Open the specified Can port (defined /dev/pcanX where X is a number 0 to 3)
//and register the callback for msg received
int openPort(int port, int bitrate, msgReceived function);
//Close the secified Can port
//and sto the receiving thread
int closePort(int port);
//Enable or disable the echo mode on the specified port
int echoPort(int port, bool enable);
//write message to bus
int writeMsg (int port,
long long id,
int dlc,
int flags,
void *msg);
}