2016-02-17 21:25:26 -04:00
|
|
|
#pragma once
|
2014-11-07 06:17:50 -04:00
|
|
|
|
2015-08-11 03:28:43 -03:00
|
|
|
#include "AP_HAL_Linux.h"
|
2014-11-07 06:17:50 -04:00
|
|
|
|
|
|
|
#include "UARTDriver.h"
|
|
|
|
|
2016-07-29 16:14:02 -03:00
|
|
|
namespace Linux {
|
2014-11-07 06:17:50 -04:00
|
|
|
|
2016-07-29 16:14:02 -03:00
|
|
|
class SPIUARTDriver : public UARTDriver {
|
2014-11-07 06:17:50 -04:00
|
|
|
public:
|
2015-10-20 18:13:25 -03:00
|
|
|
SPIUARTDriver();
|
2023-07-07 05:46:52 -03:00
|
|
|
void _begin(uint32_t b, uint16_t rxS, uint16_t txS) override;
|
2019-02-21 19:08:12 -04:00
|
|
|
void _timer_tick(void) override;
|
2024-05-06 22:42:24 -03:00
|
|
|
uint32_t get_baud_rate() const override {
|
|
|
|
return high_speed_set ? 4000000U : 1000000U;
|
|
|
|
}
|
2014-11-07 06:17:50 -04:00
|
|
|
|
|
|
|
protected:
|
2019-02-21 19:08:12 -04:00
|
|
|
int _write_fd(const uint8_t *buf, uint16_t n) override;
|
|
|
|
int _read_fd(uint8_t *buf, uint16_t n) override;
|
2014-11-07 06:17:50 -04:00
|
|
|
|
2016-04-26 17:50:19 -03:00
|
|
|
AP_HAL::OwnPtr<AP_HAL::SPIDevice> _dev;
|
2014-11-07 06:17:50 -04:00
|
|
|
|
2016-07-22 02:06:03 -03:00
|
|
|
uint8_t *_buffer;
|
|
|
|
|
2014-11-07 06:17:50 -04:00
|
|
|
uint32_t _last_update_timestamp;
|
|
|
|
|
|
|
|
bool _external;
|
2024-05-06 22:42:24 -03:00
|
|
|
|
|
|
|
bool high_speed_set;
|
2014-11-07 06:17:50 -04:00
|
|
|
};
|
2016-07-29 16:14:02 -03:00
|
|
|
|
|
|
|
}
|