arduino-emulator
Loading...
Searching...
No Matches
HardwareCAN.h
1/*
2 HardwareCAN.h - CAN bus interface for Arduino core
3 Copyright (c) 2023 Arduino. All right reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20#ifndef ARDUINOCORE_API_HARDWARECAN_H
21#define ARDUINOCORE_API_HARDWARECAN_H
22
23/**************************************************************************************
24 * INCLUDE
25 **************************************************************************************/
26
27#include "CanMsg.h"
28#include "CanMsgRingbuffer.h"
29
30/**************************************************************************************
31 * TYPEDEF
32 **************************************************************************************/
33
34enum class CanBitRate : int
35{
36 BR_125k = 125000,
37 BR_250k = 250000,
38 BR_500k = 500000,
39 BR_1000k = 1000000,
40};
41
42/**************************************************************************************
43 * NAMESPACE
44 **************************************************************************************/
45
46namespace arduino
47{
48
49/**************************************************************************************
50 * CLASS DECLARATION
51 **************************************************************************************/
52
54{
55public:
56 virtual ~HardwareCAN() {}
57
58
65 virtual bool begin(CanBitRate const can_bitrate) = 0;
66
72 virtual void end() = 0;
73
93 virtual int write(CanMsg const &msg) = 0;
94
100 virtual size_t available() = 0;
101
109 virtual CanMsg read() = 0;
110};
111
112/**************************************************************************************
113 * NAMESPACE
114 **************************************************************************************/
115
116} /* arduino */
117
118#endif /* ARDUINOCORE_API_HARDWARECAN_H */
Definition CanMsg.h:46
Definition DMAPool.h:103
Definition HardwareCAN.h:54
virtual CanMsg read()=0
virtual size_t available()=0
virtual void end()=0
virtual bool begin(CanBitRate const can_bitrate)=0
virtual int write(CanMsg const &msg)=0
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31