-
Notifications
You must be signed in to change notification settings - Fork 3
/
NewCanbus.h
executable file
·50 lines (39 loc) · 1.05 KB
/
NewCanbus.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
41
42
43
44
45
46
47
48
49
50
/**
* CAN BUS
*
* Copyright (c) 2010 Sukkin Pang All rights reserved.
*/
#include <mcp2515.h>
#ifndef newcanbus__h
#define newcanbus__h
#define CANSPEED_125 7 // CAN speed at 125 kbps
#define CANSPEED_250 3 // CAN speed at 250 kbps
#define CANSPEED_500 1 // CAN speed at 500 kbps
//
// OBDII data definitions
#define ENGINE_COOLANT_TEMP 0x05
#define ENGINE_RPM 0x0C
#define VEHICLE_SPEED 0x0D
#define MAF_SENSOR 0x10
#define O2_VOLTAGE 0x14
#define THROTTLE 0x11
#define MAP_SENSOR 0x0B
#define ENGINE_OIL_TEMP 0x5C
#define FUEL_INJECTION_TIMING 0x5D
// OBDII request & response definitions
#define PID_REQUEST 0x7DF
#define PID_REPLY 0x7E8
class NewCanbusClass
{
public:
NewCanbusClass();
char init(unsigned char);
char message_tx(uint16_t id, uint8_t data[]);
char message_rx(unsigned char *buffer);
char message_rx(tCAN *message);
void set_filters(const prog_uint8_t *filter);
private:
};
extern NewCanbusClass NewCanbus;
// extern tCAN message;
#endif