-
-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathHardwareCAN.h
62 lines (46 loc) · 1.76 KB
/
HardwareCAN.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
51
52
53
54
55
56
57
58
59
60
61
62
/*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef ARDUINOCORE_API_HARDWARECAN_H
#define ARDUINOCORE_API_HARDWARECAN_H
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include "CanMsg.h"
#include "CanMsgRingbuffer.h"
/**************************************************************************************
* TYPEDEF
**************************************************************************************/
enum class CanBitRate : int
{
BR_125k = 125000,
BR_250k = 250000,
BR_500k = 500000,
BR_1000k = 1000000,
};
/**************************************************************************************
* NAMESPACE
**************************************************************************************/
namespace arduino
{
/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/
class HardwareCAN
{
public:
virtual ~HardwareCAN() {}
virtual bool begin(CanBitRate const can_bitrate) = 0;
virtual void end() = 0;
virtual int write(CanMsg const &msg) = 0;
virtual size_t available() = 0;
virtual CanMsg read() = 0;
};
/**************************************************************************************
* NAMESPACE
**************************************************************************************/
} /* arduino */
#endif /* ARDUINOCORE_API_HARDWARECAN_H */