2016-02-17 21:25:44 -04:00
|
|
|
#pragma once
|
2015-08-28 06:52:34 -03:00
|
|
|
|
|
|
|
#include "RangeFinder.h"
|
|
|
|
#include "RangeFinder_Backend.h"
|
2016-05-24 15:51:54 -03:00
|
|
|
#include <AP_HAL/I2CDevice.h>
|
2015-08-28 06:52:34 -03:00
|
|
|
|
|
|
|
class AP_RangeFinder_LightWareI2C : public AP_RangeFinder_Backend
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
// static detection function
|
2016-05-24 15:51:54 -03:00
|
|
|
static AP_RangeFinder_Backend *detect(RangeFinder &ranger, uint8_t instance, RangeFinder::RangeFinder_State &_state, AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev);
|
2015-08-28 06:52:34 -03:00
|
|
|
|
|
|
|
// update state
|
|
|
|
void update(void);
|
|
|
|
|
|
|
|
private:
|
2016-05-24 15:51:54 -03:00
|
|
|
// constructor
|
|
|
|
AP_RangeFinder_LightWareI2C(RangeFinder &ranger, uint8_t instance, RangeFinder::RangeFinder_State &_state, AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev);
|
|
|
|
|
2016-12-06 16:02:58 -04:00
|
|
|
void init();
|
2017-01-13 15:26:14 -04:00
|
|
|
void timer();
|
|
|
|
|
2015-08-28 06:52:34 -03:00
|
|
|
// get a reading
|
|
|
|
bool get_reading(uint16_t &reading_cm);
|
2016-05-24 15:51:54 -03:00
|
|
|
AP_HAL::OwnPtr<AP_HAL::I2CDevice> _dev;
|
2015-08-28 06:52:34 -03:00
|
|
|
};
|