123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- #pragma once
- #include <inttypes.h>
- #include <string.h>
- #include <assert.h>
- #include <cmath>
- #if HAL_WITH_UAVCAN
- #include "AP_HAL_Namespace.h"
- #include "utility/functor.h"
- #include <uavcan/driver/can.hpp>
- #include <uavcan/time.hpp>
- #define MAX_NUMBER_OF_CAN_INTERFACES 2
- #define MAX_NUMBER_OF_CAN_DRIVERS 2
- class AP_HAL::CANProtocol {
- public:
-
- virtual void init(uint8_t driver_index, bool enable_filters) = 0;
- };
- class AP_HAL::CAN: public uavcan::ICanIface {
- public:
-
- virtual bool begin(uint32_t bitrate) = 0;
-
- virtual void end() = 0;
-
- virtual void reset() = 0;
-
- virtual bool is_initialized() = 0;
-
- virtual int32_t tx_pending() = 0;
-
- virtual int32_t available() = 0;
- };
- class AP_HAL::CANManager {
- public:
- CANManager(uavcan::ICanDriver* driver) : _driver(driver) {}
-
- virtual bool begin(uint32_t bitrate, uint8_t can_number) = 0;
-
- virtual bool is_initialized() = 0;
- virtual void initialized(bool val) = 0;
- uavcan::ICanDriver* get_driver() { return _driver; }
- private:
- uavcan::ICanDriver* _driver;
- };
- #endif
|