mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: drivers/CAN.h
- Revision:
- 188:bcfe06ba3d64
- Parent:
- 187:0387e8f68319
- Child:
- 189:f392fc9709a3
--- a/drivers/CAN.h Thu Sep 06 13:40:20 2018 +0100 +++ b/drivers/CAN.h Thu Nov 08 11:46:34 2018 +0000 @@ -55,7 +55,7 @@ * @param _type Type of Data: Use enum CANType for valid parameter values * @param _format Data Format: Use enum CANFormat for valid parameter values */ - CANMessage(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) + CANMessage(unsigned _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) { len = _len & 0xF; type = _type; @@ -69,7 +69,7 @@ * @param _id Message ID * @param _format Data Format: Use enum CANType for valid parameter values */ - CANMessage(int _id, CANFormat _format = CANStandard) + CANMessage(unsigned _id, CANFormat _format = CANStandard) { len = 0; type = CANRemote; @@ -85,7 +85,7 @@ class CAN : private NonCopyable<CAN> { public: - /** Creates an CAN interface connected to specific pins. + /** Creates a CAN interface connected to specific pins. * * @param rd read from transmitter * @param td transmit to transmitter @@ -94,11 +94,14 @@ * @code * #include "mbed.h" * + * * Ticker ticker; * DigitalOut led1(LED1); * DigitalOut led2(LED2); - * CAN can1(p9, p10); - * CAN can2(p30, p29); + * //The constructor takes in RX, and TX pin respectively. + * //These pins, for this example, are defined in mbed_app.json + * CAN can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD); + * CAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD); * * char counter = 0; * @@ -121,14 +124,15 @@ * wait(0.2); * } * } + * * @endcode */ CAN(PinName rd, PinName td); /** Initialize CAN interface and set the frequency * - * @param rd the rd pin - * @param td the td pin + * @param rd the read pin + * @param td the transmit pin * @param hz the bus frequency in hertz */ CAN(PinName rd, PinName td, int hz); @@ -197,7 +201,7 @@ */ int mode(Mode mode); - /** Filter out incomming messages + /** Filter out incoming messages * * @param id the id to filter on * @param mask the mask applied to the id @@ -288,12 +292,14 @@ static void _irq_handler(uint32_t id, CanIrqType type); +#if !defined(DOXYGEN_ONLY) protected: virtual void lock(); virtual void unlock(); can_t _can; Callback<void()> _irq[IrqCnt]; PlatformMutex _mutex; +#endif }; } // namespace mbed