2016-02-17 21:25:44 -04:00
|
|
|
#pragma once
|
2015-07-06 16:24:06 -03:00
|
|
|
|
2023-06-23 22:09:28 -03:00
|
|
|
#include "AP_RangeFinder_config.h"
|
2022-03-12 06:37:29 -04:00
|
|
|
|
|
|
|
#if AP_RANGEFINDER_BBB_PRU_ENABLED
|
2015-07-06 16:24:06 -03:00
|
|
|
|
2023-06-23 22:09:28 -03:00
|
|
|
#include "AP_RangeFinder_Backend.h"
|
|
|
|
|
2015-07-06 16:24:06 -03:00
|
|
|
#define PRU0_CTRL_BASE 0x4a322000
|
|
|
|
|
|
|
|
#define PRU0_IRAM_BASE 0x4a334000
|
|
|
|
#define PRU0_IRAM_SIZE 0x2000
|
|
|
|
|
|
|
|
#define PRU0_DRAM_BASE 0x4a300000
|
2016-01-18 15:54:43 -04:00
|
|
|
#define PRU0_DRAM_SIZE 0x2000
|
2015-07-06 16:24:06 -03:00
|
|
|
|
|
|
|
struct range {
|
|
|
|
uint32_t distance;
|
|
|
|
uint32_t status;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AP_RangeFinder_BBB_PRU : public AP_RangeFinder_Backend
|
|
|
|
{
|
|
|
|
public:
|
2021-10-28 13:21:38 -03:00
|
|
|
/*
|
|
|
|
Constructor:
|
|
|
|
The constructor also initialises the rangefinder. Note that this
|
|
|
|
constructor is not called until detect() returns true, so we
|
|
|
|
already know that we should setup the rangefinder
|
|
|
|
*/
|
|
|
|
using AP_RangeFinder_Backend::AP_RangeFinder_Backend;
|
2015-07-06 16:24:06 -03:00
|
|
|
|
|
|
|
// static detection function
|
2017-08-07 00:41:01 -03:00
|
|
|
static bool detect();
|
2015-07-06 16:24:06 -03:00
|
|
|
|
|
|
|
// update state
|
2018-11-07 07:01:51 -04:00
|
|
|
void update(void) override;
|
2015-07-06 16:24:06 -03:00
|
|
|
|
2017-08-08 04:32:53 -03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
|
|
|
|
return MAV_DISTANCE_SENSOR_ULTRASOUND;
|
|
|
|
}
|
|
|
|
|
2015-07-06 16:24:06 -03:00
|
|
|
private:
|
|
|
|
|
|
|
|
};
|
2022-03-12 06:37:29 -04:00
|
|
|
|
2023-06-23 22:09:28 -03:00
|
|
|
#endif // AP_RANGEFINDER_BBB_PRU_ENABLED
|