CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_CANManager/AP_CANDriver.h
Views: 1798
1
/*
2
* This file is free software: you can redistribute it and/or modify it
3
* under the terms of the GNU General Public License as published by the
4
* Free Software Foundation, either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* This file is distributed in the hope that it will be useful, but
8
* WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
* See the GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License along
13
* with this program. If not, see <http://www.gnu.org/licenses/>.
14
*
15
* Code by Siddharth Bharat Purohit
16
*/
17
18
#pragma once
19
20
#include <AP_Common/AP_Common.h>
21
#include <AP_HAL/AP_HAL.h>
22
23
class AP_CANManager;
24
class CANSensor;
25
26
class AP_CANDriver
27
{
28
public:
29
30
friend class AP_CANManager;
31
32
// init method for protocol drivers, specify driver index and if filters
33
// are to be enabled
34
virtual void init(uint8_t driver_index, bool enable_filters) = 0;
35
36
// link protocol drivers with interfaces by adding reference to CANIface
37
virtual bool add_interface(AP_HAL::CANIface* can_iface) = 0;
38
39
// add an 11 bit auxillary driver
40
virtual bool add_11bit_driver(CANSensor *sensor) { return false; }
41
42
// handler for outgoing frames for auxillary drivers
43
virtual bool write_aux_frame(AP_HAL::CANFrame &out_frame, const uint32_t timeout_us) { return false; }
44
};
45
46