forked from Longan-Labs/CANBedDual_Arduino_Lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
canbed_dual.h
40 lines (29 loc) · 993 Bytes
/
canbed_dual.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
36
37
38
39
40
// aruino library for CANBed Dual
#include <Wire.h>
#include <Arduino.h>
#define I2C_ADDR 0X41
#define CANI2C Wire1
#define DELAY_TIME 0
class CANBedDual
{
private:
unsigned long timerDelay = 0;
int canNum = 0;
unsigned char canconfig[48];
private:
unsigned long char2long(unsigned char *str);
void long2char(unsigned long __t, unsigned char *str);
void makeCanConfig();
void sendConfig();
public:
CANBedDual(int num)
{
canNum = num;
}
void init(unsigned long speed);
void initFD(unsigned long speed20, unsigned long speedfd);
void initMaskFilt(unsigned char num, unsigned char ext, unsigned long mask, unsigned long filt);
void send(unsigned long id, unsigned char ext, unsigned char rtr, unsigned char fd, unsigned char len, unsigned char *dta);
byte checkRecv();
byte read(unsigned long *id, int *ext, int *rtr, int *fd, int *len, unsigned char *str);
};