File tree 1 file changed +23
-1
lines changed
1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 20
20
// #define IS_TEENSY_BUILTIN // Teensy boards with built-in CAN interface (e.g. Teensy 4.1). See below to select which interface to use.
21
21
// #define IS_ARDUINO_BUILTIN // Arduino boards with built-in CAN interface (e.g. Arduino Uno R4 Minima)
22
22
// #define IS_MCP2515 // Any board with external MCP2515 based extension module. See below to configure the module.
23
+ // #define IS_STM32_BUILTIN // STM32 boards with built-in CAN interface (e.g. STM32F4 Discovery).
23
24
24
25
25
26
/* Board-specific includes ---------------------------------------------------*/
26
27
27
- #if defined(IS_TEENSY_BUILTIN) + defined(IS_ARDUINO_BUILTIN) + defined(IS_MCP2515) != 1
28
+ #if defined(IS_TEENSY_BUILTIN) + defined(IS_ARDUINO_BUILTIN) + defined(IS_MCP2515) + defined(IS_STM32_BUILTIN) != 1
28
29
#warning "Select exactly one hardware option at the top of this file."
29
30
30
31
#if CAN_HOWMANY > 0 || CANFD_HOWMANY > 0
58
59
struct ODriveStatus ; // hack to prevent teensy compile error
59
60
#endif // IS_TEENSY_BUILTIN
60
61
62
+ #ifdef IS_STM32_BUILTIN
63
+ // See https://github.com/pazi88/STM32_CAN
64
+ #include < STM32_CAN.h>
65
+ #include " ODriveSTM32CAN.hpp"
66
+ #endif // IS_STM32_BUILTIN
61
67
62
68
63
69
@@ -138,6 +144,22 @@ bool setupCan() {
138
144
#endif
139
145
140
146
147
+ /* STM32 boards with built-in CAN */
148
+
149
+ #ifdef IS_STM32_BUILTIN
150
+
151
+ STM32_CAN Can1 ( CAN1 );
152
+ STM32_CAN& can_intf = Can1;
153
+
154
+ bool setupCan () {
155
+ can_intf.begin ();
156
+ can_intf.setBaudRate (CAN_BAUDRATE);
157
+ return true ;
158
+ }
159
+
160
+ #endif // IS_STM32_BUILTIN
161
+
162
+
141
163
/* Example sketch ------------------------------------------------------------*/
142
164
143
165
// Instantiate ODrive objects
You can’t perform that action at this time.
0 commit comments