1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #pragma once
- #include "AP_HAL_ChibiOS.h"
- #if HAL_WITH_UAVCAN
- #define CAN_STM32_LOG(fmt, ...) hal.console->printf("CANManager: " fmt "\n", ##__VA_ARGS__)
- #include <uavcan/uavcan.hpp>
- #include <uavcan/time.hpp>
- #include "CANThread.h"
- #include "CANClock.h"
- #if defined(STM32H7XX)
- #include "CANFDIface.h"
- #else
- #include "CANIface.h"
- #endif
- #define MAX_NUMBER_OF_CAN_INTERFACES 2
- #define MAX_NUMBER_OF_CAN_DRIVERS 2
- #define CAN_STM32_RX_QUEUE_SIZE 64
- namespace ChibiOS {
- class CANManager: public AP_HAL::CANManager {
- public:
- CANManager()
- : can_helper(), AP_HAL::CANManager(&can_helper.driver) { }
-
-
- static CANManager *from(AP_HAL::CANManager *can)
- {
- return static_cast<CANManager*>(can);
- }
- bool begin(uint32_t bitrate, uint8_t can_number) override;
-
- bool is_initialized() override;
- void initialized(bool val) override;
- private:
- bool initialized_;
- ChibiOS_CAN::CanInitHelper<CAN_STM32_RX_QUEUE_SIZE> can_helper;
- };
- }
- #endif
|