You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libraries/mbed/api/CAN.h
+39-8Lines changed: 39 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -150,6 +150,25 @@ class CAN {
150
150
*/
151
151
voidmonitor(bool silent);
152
152
153
+
enum Mode {
154
+
Reset = 0,
155
+
Normal,
156
+
Silent,
157
+
LocalTest,
158
+
GlobalTest,
159
+
SilentTest
160
+
};
161
+
162
+
/** Change CAN operation to the specified mode
163
+
*
164
+
* @param mode The new operation mode (CAN::Normal, CAN::Silent, CAN::LocalTest, CAN::GlobalTest, CAN::SilentTest)
165
+
*
166
+
* @returns
167
+
* 0 if mode change failed or unsupported,
168
+
* 1 if mode change was successful
169
+
*/
170
+
intmode(Mode mode);
171
+
153
172
/** Returns number of read errors to detect read overflow errors.
154
173
*/
155
174
unsignedcharrderror();
@@ -158,33 +177,45 @@ class CAN {
158
177
*/
159
178
unsignedchartderror();
160
179
180
+
enum IrqType {
181
+
RxIrq = 0,
182
+
TxIrq,
183
+
EwIrq,
184
+
DoIrq,
185
+
WuIrq,
186
+
EpIrq,
187
+
AlIrq,
188
+
BeIrq,
189
+
IdIrq
190
+
};
191
+
161
192
/** Attach a function to call whenever a CAN frame received interrupt is
162
193
* generated.
163
194
*
164
195
* @param fptr A pointer to a void function, or 0 to set as none
165
-
* @param event Which can interrupt to attach the member function to (CAN::IRQ_RX, CAN::IRQ_TX, CAN::IRQ_ERROR, CAN::IRQ_OVERRUN, CAN::IRQ_WAKEUP, CAN::IRQ_PASSIVE, CAN::IRQ_ARB, CAN::IRQ_BUS, CAN::IRQ_READY) - Note that not every event is supported by all hardware
196
+
* @param event Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, CAN::TxIrq for transmitted or aborted, CAN::EwIrq for error warning, CAN::DoIrq for data overrun, CAN::WuIrq for wake-up, CAN::EpIrq for error passive, CAN::AlIrq for arbitration lost, CAN::BeIrq for bus error)
/** Attach a member function to call whenever a CAN frame received interrupt
170
201
* is generated.
171
202
*
172
203
* @param tptr pointer to the object to call the member function on
173
204
* @param mptr pointer to the member function to be called
174
-
* @param event Which can interrupt to attach the member function to (CAN::IRQ_RX, CAN::IRQ_TX, CAN::IRQ_ERROR, CAN::IRQ_OVERRUN, CAN::IRQ_WAKEUP, CAN::IRQ_PASSIVE, CAN::IRQ_ARB, CAN::IRQ_BUS, CAN::IRQ_READY) - Note that not every event is supported by all hardware
205
+
* @param event Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, TxIrq for transmitted or aborted, EwIrq for error warning, DoIrq for data overrun, WuIrq for wake-up, EpIrq for error passive, AlIrq for arbitration lost, BeIrq for bus error)
0 commit comments