@@ -85,7 +85,7 @@ class CANMessage : public CAN_Message {
85
85
class CAN : private NonCopyable <CAN> {
86
86
87
87
public:
88
- /* * Creates an CAN interface connected to specific pins.
88
+ /* * Creates a CAN interface connected to specific pins.
89
89
*
90
90
* @param rd read from transmitter
91
91
* @param td transmit to transmitter
@@ -94,11 +94,15 @@ class CAN : private NonCopyable<CAN> {
94
94
* @code
95
95
* #include "mbed.h"
96
96
*
97
+ * #if defined (DEVICE_CAN) || defined(DOXYGEN_ONLY)
98
+ *
97
99
* Ticker ticker;
98
100
* DigitalOut led1(LED1);
99
101
* DigitalOut led2(LED2);
100
- * CAN can1(p9, p10);
101
- * CAN can2(p30, p29);
102
+ * //The constructor takes in RX, and TX pin respectively.
103
+ * //These pins, for this example, are defined in mbed_app.json
104
+ * CAN can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD);
105
+ * CAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD);
102
106
*
103
107
* char counter = 0;
104
108
*
@@ -121,14 +125,19 @@ class CAN : private NonCopyable<CAN> {
121
125
* wait(0.2);
122
126
* }
123
127
* }
128
+ *
129
+ * #else
130
+ * #error CAN NOT SUPPORTED
131
+ *
132
+ * #endif
124
133
* @endcode
125
134
*/
126
135
CAN (PinName rd, PinName td);
127
136
128
137
/* * Initialize CAN interface and set the frequency
129
138
*
130
- * @param rd the rd pin
131
- * @param td the td pin
139
+ * @param rd the read pin
140
+ * @param td the transmit pin
132
141
* @param hz the bus frequency in hertz
133
142
*/
134
143
CAN (PinName rd, PinName td, int hz);
@@ -288,13 +297,15 @@ class CAN : private NonCopyable<CAN> {
288
297
289
298
static void _irq_handler (uint32_t id, CanIrqType type);
290
299
300
+ #if !defined(DOXYGEN_ONLY)
291
301
protected:
292
302
virtual void lock ();
293
303
virtual void unlock ();
294
304
can_t _can;
295
305
Callback<void ()> _irq[IrqCnt];
296
306
PlatformMutex _mutex;
297
307
};
308
+ #endif
298
309
299
310
} // namespace mbed
300
311
0 commit comments