AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
twai_plugin.hpp
Go to the documentation of this file.
1//================================================================================================
8//================================================================================================
9#ifndef TWAI_PLUGIN_HPP
10#define TWAI_PLUGIN_HPP
11#ifdef ESP_PLATFORM
12
16
17#include "driver/twai.h"
18
19#include <string>
20
21namespace isobus
22{
23 //================================================================================================
27 //================================================================================================
28 class TWAIPlugin : public CANHardwarePlugin
29 {
30 public:
35 explicit TWAIPlugin(const twai_general_config_t *generalConfig, const twai_timing_config_t *timingConfig, const twai_filter_config_t *filterConfig);
36
38 virtual ~TWAIPlugin();
39
42 bool get_is_valid() const override;
43
45 void close() override;
46
48 void open() override;
49
53 bool read_frame(isobus::CANMessageFrame &canFrame) override;
54
58 bool write_frame(const isobus::CANMessageFrame &canFrame) override;
59
60 private:
61 const twai_general_config_t *generalConfig;
62 const twai_timing_config_t *timingConfig;
63 const twai_filter_config_t *filterConfig;
64 };
65}
66#endif // ESP_PLATFORM
67#endif // TWAI_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.
A CAN frame for interfacing with a hardware layer, like socket CAN or other interface.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...