11#include "FlexCAN_T4.hpp"
16#if defined(__IMXRT1062__)
17 FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can0;
18 FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can1;
19 FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can2;
20#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
21 FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can0;
22 FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can1;
26 selectedChannel(channel)
46 can0.setBaudRate(250000);
52 can1.setBaudRate(250000);
55#if defined(__IMXRT1062__)
59 can2.setBaudRate(250000);
65 LOG_CRITICAL(
"[FlexCAN]: Invalid Channel Selected");
71 CAN_message_t message;
76 retVal = can0.read(message);
81 retVal = can1.read(message);
84#if defined(__IMXRT1062__)
87 retVal = can2.read(message);
92 memcpy(canFrame.
data, message.buf, 8);
101 CAN_message_t message;
106 message.flags.extended =
true;
112 retVal = can0.write(message);
116 retVal = can1.write(message);
118#if defined(__IMXRT1062__)
121 retVal = can2.write(message);
A class that acts as a logging sink. The intent is that someone could make their own derived class of...
A CAN frame for interfacing with a hardware layer, like socket CAN or other interface.
std::uint8_t dataLength
The length of the data used in the frame.
std::uint32_t identifier
The 32 bit identifier of the frame.
bool isExtendedFrame
Denotes if the frame is extended format.
std::uint8_t data[8]
The data payload of the frame.
std::uint8_t channel
The CAN channel index associated with the frame.
bool write_frame(const isobus::CANMessageFrame &canFrame) override
Writes a frame to the bus (synchronous)
bool isOpen
Tracks if the connection is open/connected.
bool get_is_valid() const override
Returns if the connection with the hardware is valid.
void close() override
Closes the connection to the hardware.
FlexCANT4Plugin(std::uint8_t channel)
Constructor for the FlexCANT4Plugin.
std::uint8_t selectedChannel
The channel that this plugin is assigned to.
bool read_frame(isobus::CANMessageFrame &canFrame) override
Returns a frame from the hardware (synchronous), or false if no frame can be read.
void open() override
Connects to the hardware you specified in the constructor's channel argument.
An interface for using FlexCAN_T4 on a Teensy4/4.1 device.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...