Class TwaiInterface¶
Defined in File hi_can_twai.hpp
Inheritance Relationships¶
Base Type¶
public hi_can::FilteredCanInterface(Class FilteredCanInterface)
Class Documentation¶
-
class TwaiInterface : public hi_can::FilteredCanInterface¶
Inheritance diagram for hi_can::TwaiInterface:
Collaboration diagram for hi_can::TwaiInterface:
Public Functions¶
-
virtual ~TwaiInterface()¶
-
TwaiInterface(const TwaiInterface&) = delete¶
-
inline TwaiInterface(TwaiInterface &&other) noexcept¶
-
TwaiInterface &operator=(const TwaiInterface&) = delete¶
-
inline TwaiInterface &operator=(TwaiInterface &&other) noexcept¶
-
virtual std::optional<Packet> receive(bool blocking = false) override¶
Pulls the next packet from the CAN bus buffer.
-
void handle()¶
Handle error detection and recovery on the underlying TWAI bus.
This function must be called regularly to ensure that the bus recovers and has errors handled correctly.
-
virtual TwaiInterface &add_filter(const addressing::filter_t &address) override¶
Add a filter to the interface.
- Returns:¶
Itself for chaining
-
virtual TwaiInterface &remove_filter(const addressing::filter_t &address) override¶
Remove a filter from the interface.
- Returns:¶
Itself for chaining
Public Static Functions¶
-
static TwaiInterface &get_instance(bsp::pin_pair_t pins = std::make_pair(bsp::CAN_TX_PIN, bsp::CAN_RX_PIN), uint8_t controller_id = 0, addressing::filter_t filter = {})¶
Friends¶
-
inline friend void swap(TwaiInterface &first, TwaiInterface &second) noexcept¶
-
virtual ~TwaiInterface()¶