1
+ /* mbed Microcontroller Library
2
+ * Copyright (c) 2019 ARM Limited
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ #ifndef RAWCAN_H
19
+ #define RAWCAN_H
20
+
21
+ #include " platform/platform.h"
22
+ #include " drivers/CAN.h"
23
+
24
+ #if DEVICE_CAN || defined(DOXYGEN_ONLY)
25
+
26
+ #include " interfaces/InterfaceCAN.h"
27
+ #include " hal/can_api.h"
28
+ #include " platform/Callback.h"
29
+ #include " platform/PlatformMutex.h"
30
+
31
+ namespace mbed {
32
+ class RawCAN : public CAN {
33
+ public:
34
+ RawCAN (PinName rd, PinName td);
35
+
36
+ /* * Initialize CAN interface and set the frequency
37
+ *
38
+ * @param rd the read pin
39
+ * @param td the transmit pin
40
+ * @param hz the bus frequency in hertz
41
+ */
42
+ RawCAN (PinName rd, PinName td, int hz);
43
+
44
+ /* * Initialize CAN interface
45
+ *
46
+ * @param pinmap reference to structure which holds static pinmap
47
+ * @param td the transmit pin
48
+ * @param hz the bus frequency in hertz
49
+ */
50
+
51
+ virtual ~RawCAN () {};
52
+
53
+ /* * Read a CANMessage from the bus.
54
+ *
55
+ * @param msg A CANMessage to read to.
56
+ * @param handle message filter handle (0 for any message)
57
+ *
58
+ * @returns
59
+ * 0 if no message arrived,
60
+ * 1 if message arrived
61
+ */
62
+ int read (CANMessage &msg, int handle = 0 );
63
+
64
+ };
65
+ } // namespace mbed
66
+
67
+ #endif
68
+
69
+ #endif // RAWCAN_H
0 commit comments