Skip to content

Commit 49e58dd

Browse files
committed
Make interface::CAN buildable on targets without DEVICE_CAN
This commit adds provisions to enable using interface::CAN on targets that don't have DEVICE_CAN set to 1 (ie: they don't normally have a CAN peripheral).
1 parent d6104c8 commit 49e58dd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

drivers/include/drivers/interfaces/InterfaceCAN.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828

2929
namespace mbed {
3030

31+
#ifndef FEATURE_EXPERIMENTAL_API
3132
// Forward declare CAN
3233
class CAN;
34+
#endif
3335

3436
/** \defgroup drivers-public-api-can CAN
3537
* \ingroup drivers-public-api
@@ -171,6 +173,11 @@ using CAN = ::mbed::CAN;
171173
#endif
172174

173175
} // namespace interface
176+
177+
#if defined(FEATURE_EXPERIMENTAL_API) && !DEVICE_CAN
178+
using CAN = interface::CAN;
179+
#endif
180+
174181
} // namespace mbed
175182

176183
#endif /* MBED_INTERFACE_CAN_H_ */

hal/include/hal/can_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#ifndef MBED_CAN_HELPER_H
2121
#define MBED_CAN_HELPER_H
2222

23-
#if DEVICE_CAN
23+
#if DEVICE_CAN || FEATURE_EXPERIMENTAL_API
2424

2525
#ifdef __cplusplus
2626
extern "C" {

0 commit comments

Comments
 (0)