Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UAVCAN UAVCAN_Subscriber
CanDriver Class Reference
CAN driver, incorporates all available CAN ifaces. More...
#include <can.hpp>
Inherits uavcan::ICanDriver, and uavcan::Noncopyable.
Public Member Functions | |
| uavcan::CanSelectMasks | makeSelectMasks (const uavcan::CanFrame *(&pending_tx)[uavcan::MaxCanIfaces]) const |
| This function returns select masks indicating which interfaces are available for read/write. | |
| bool | hasReadableInterfaces () const |
| Whether there's at least one interface where receive() would return a frame. | |
| int | init (const uavcan::uint32_t bitrate, const CanIface::OperatingMode mode) |
| Returns zero if OK. | |
| virtual CanIface * | getIface (uavcan::uint8_t iface_index) |
| Returns an interface by index, or null pointer if the index is out of range. | |
| virtual uavcan::uint8_t | getNumIfaces () const |
| Total number of available CAN interfaces. | |
| bool | hadActivity () |
| Whether at least one iface had at least one successful IO since previous call of this method. | |
| virtual const ICanIface * | getIface (uint8_t iface_index) const |
| Default implementation of this method calls the non-const overload of getIface(). | |
| virtual int16_t | select (CanSelectMasks &inout_masks, const CanFrame *(&pending_tx)[MaxCanIfaces], MonotonicTime blocking_deadline)=0 |
| Block until the deadline, or one of the specified interfaces becomes available for read or write. | |
Detailed Description
CAN driver, incorporates all available CAN ifaces.
Please avoid direct use, prefer CanInitHelper instead.
Definition at line 234 of file drivers/stm32/driver/include/uavcan_stm32/can.hpp.
Member Function Documentation
| CanIface * getIface | ( | uavcan::uint8_t | iface_index ) | [virtual] |
Returns an interface by index, or null pointer if the index is out of range.
Implements ICanDriver.
Definition at line 1090 of file uc_stm32_can.cpp.
| virtual const ICanIface* getIface | ( | uint8_t | iface_index ) | const [virtual, inherited] |
Default implementation of this method calls the non-const overload of getIface().
Can be overriden by the application if necessary.
Definition at line 211 of file include/uavcan/driver/can.hpp.
| virtual uavcan::uint8_t getNumIfaces | ( | ) | const [virtual] |
Total number of available CAN interfaces.
This value shall not change after initialization.
Implements ICanDriver.
Definition at line 278 of file drivers/stm32/driver/include/uavcan_stm32/can.hpp.
| bool hadActivity | ( | ) |
Whether at least one iface had at least one successful IO since previous call of this method.
This is designed for use with iface activity LEDs.
Definition at line 1099 of file uc_stm32_can.cpp.
| bool hasReadableInterfaces | ( | ) | const |
Whether there's at least one interface where receive() would return a frame.
Definition at line 911 of file uc_stm32_can.cpp.
| int init | ( | const uavcan::uint32_t | bitrate, |
| const CanIface::OperatingMode | mode | ||
| ) |
Returns zero if OK.
Returns negative value if failed (e.g. invalid bitrate).
Definition at line 1038 of file uc_stm32_can.cpp.
| uavcan::CanSelectMasks makeSelectMasks | ( | const uavcan::CanFrame *(&) | pending_tx[uavcan::MaxCanIfaces] ) | const |
This function returns select masks indicating which interfaces are available for read/write.
Definition at line 881 of file uc_stm32_can.cpp.
| virtual int16_t select | ( | CanSelectMasks & | inout_masks, |
| const CanFrame *(&) | pending_tx[MaxCanIfaces], | ||
| MonotonicTime | blocking_deadline | ||
| ) | [pure virtual, inherited] |
Block until the deadline, or one of the specified interfaces becomes available for read or write.
Iface masks will be modified by the driver to indicate which exactly interfaces are available for IO.
Bit position in the masks defines interface index.
Note that it is allowed to return from this method even if no requested events actually happened, or if there are events that were not requested by the library.
The pending TX argument contains an array of pointers to CAN frames that the library wants to transmit next, per interface. This is intended to allow the driver to properly prioritize transmissions; many drivers will not need to use it. If a write flag for the given interface is set to one in the select mask structure, then the corresponding pointer is guaranteed to be valid (not UAVCAN_NULLPTR).
- Parameters:
-
[in,out] inout_masks Masks indicating which interfaces are needed/available for IO. [in] pending_tx Array of frames, per interface, that are likely to be transmitted next. [in] blocking_deadline Zero means non-blocking operation.
- Returns:
- Positive number of ready interfaces or negative error code.
Generated on Tue Jul 12 2022 17:17:38 by
1.7.2