File tree 2 files changed +42
-6
lines changed
2 files changed +42
-6
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * This file is free software; you can redistribute it and/or modify
3
+ * it under the terms of either the GNU General Public License version 2
4
+ * or the GNU Lesser General Public License version 2.1, both as
5
+ * published by the Free Software Foundation.
6
+ */
7
+
8
+ /* *************************************************************************************
9
+ * INCLUDE
10
+ **************************************************************************************/
11
+
12
+ #include " CanMsg.h"
13
+
14
+ /* *************************************************************************************
15
+ * NAMESPACE
16
+ **************************************************************************************/
17
+
18
+ namespace arduino
19
+ {
20
+
21
+ /* *************************************************************************************
22
+ * STATIC CONST DEFINITION
23
+ **************************************************************************************/
24
+
25
+ size_t const CanMsg::MAX_DATA_LENGTH;
26
+ uint32_t const CanMsg::CAN_EFF_FLAG;
27
+ uint32_t const CanMsg::CAN_SFF_MASK;
28
+ uint32_t const CanMsg::CAN_EFF_MASK;
29
+
30
+ /* *************************************************************************************
31
+ * NAMESPACE
32
+ **************************************************************************************/
33
+
34
+ } /* arduino */
Original file line number Diff line number Diff line change 15
15
#include < stdint.h>
16
16
#include < string.h>
17
17
18
- #include < Arduino.h>
18
+ #include " Print.h"
19
+ #include " Printable.h"
20
+ #include " Common.h"
19
21
20
22
/* *************************************************************************************
21
23
* NAMESPACE
@@ -112,20 +114,20 @@ class CanMsg : public Printable
112
114
* |- Bit 29 : reserved (future error frame flag)
113
115
* |- Bit 0-28 : CAN identifier (11/29 bit)
114
116
*/
115
- uint32_t id;
116
- uint8_t data_length;
117
- uint8_t data[MAX_DATA_LENGTH];
117
+ private: uint32_t id;
118
+ public: uint8_t data_length;
119
+ public: uint8_t data[MAX_DATA_LENGTH];
118
120
};
119
121
120
122
/* *************************************************************************************
121
123
* FREE FUNCTIONS
122
124
**************************************************************************************/
123
125
124
- static uint32_t CanStandardId (uint32_t const id) {
126
+ inline uint32_t CanStandardId (uint32_t const id) {
125
127
return (id & CanMsg::CAN_SFF_MASK);
126
128
}
127
129
128
- static uint32_t CanExtendedId (uint32_t const id) {
130
+ inline uint32_t CanExtendedId (uint32_t const id) {
129
131
return (CanMsg::CAN_EFF_FLAG | (id & CanMsg::CAN_EFF_MASK));
130
132
}
131
133
You can’t perform that action at this time.
0 commit comments