AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
flex_can_t4_plugin.hpp
Go to the documentation of this file.
1//================================================================================================
8//================================================================================================
9#ifndef FLEX_CAN_T4_PLUGIN_HPP
10#define FLEX_CAN_T4_PLUGIN_HPP
11
12#include "FlexCAN_T4.hpp"
16
17namespace isobus
18{
21 {
22 public:
25 explicit FlexCANT4Plugin(std::uint8_t channel);
26
28 virtual ~FlexCANT4Plugin() = default;
29
32 bool get_is_valid() const override;
33
35 void close() override;
36
38 void open() override;
39
43 bool read_frame(isobus::CANMessageFrame &canFrame) override;
44
48 bool write_frame(const isobus::CANMessageFrame &canFrame) override;
49
50 private:
51#if defined(__IMXRT1062__)
52 static FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_512> can0;
53 static FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_512> can1;
54 static FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_512> can2;
55#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
56 static FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_512> can0;
57 static FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_512> can1;
58#endif
59 std::uint8_t selectedChannel;
60 bool isOpen = false;
61 };
62}
63#endif // FLEX_CAN_T4_PLUGIN_HPP
An abstraction between this CAN stack and any hardware layer.
A base class for a CAN driver. Can be derived into your platform's required interface.
A classical CAN frame, with 8 data bytes.
An abstract base class for a CAN driver.
A CAN frame for interfacing with a hardware layer, like socket CAN or other interface.
An interface for using FlexCAN_T4 on a Teensy4/4.1 device.
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.
virtual ~FlexCANT4Plugin()=default
The destructor for FlexCANT4Plugin.
void open() override
Connects to the hardware you specified in the constructor's channel argument.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...