2013-05-29 20:51:11 -03:00
|
|
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
2016-02-17 21:25:44 -04:00
|
|
|
#pragma once
|
2012-11-11 11:25:29 -04:00
|
|
|
|
|
|
|
#include "RangeFinder.h"
|
2014-06-27 01:03:47 -03:00
|
|
|
#include "RangeFinder_Backend.h"
|
2012-11-11 11:25:29 -04:00
|
|
|
|
|
|
|
#define AP_RANGE_FINDER_MAXSONARI2CXL_DEFAULT_ADDR 0x70
|
|
|
|
|
|
|
|
#define AP_RANGEFINDER_MAXSONARI2CXL 4
|
|
|
|
#define AP_RANGE_FINDER_MAXSONARI2CXL_SCALER 1.0
|
|
|
|
#define AP_RANGE_FINDER_MAXSONARI2CXL_MIN_DISTANCE 20
|
|
|
|
#define AP_RANGE_FINDER_MAXSONARI2CXL_MAX_DISTANCE 765
|
|
|
|
|
|
|
|
#define AP_RANGE_FINDER_MAXSONARI2CXL_COMMAND_TAKE_RANGE_READING 0x51
|
|
|
|
|
2014-06-27 01:03:47 -03:00
|
|
|
class AP_RangeFinder_MaxsonarI2CXL : public AP_RangeFinder_Backend
|
2012-11-11 11:25:29 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor
|
2014-06-27 01:03:47 -03:00
|
|
|
AP_RangeFinder_MaxsonarI2CXL(RangeFinder &ranger, uint8_t instance, RangeFinder::RangeFinder_State &_state);
|
2012-11-11 11:25:29 -04:00
|
|
|
|
2014-06-27 01:03:47 -03:00
|
|
|
// static detection function
|
|
|
|
static bool detect(RangeFinder &ranger, uint8_t instance);
|
2012-11-11 11:25:29 -04:00
|
|
|
|
2014-06-27 01:03:47 -03:00
|
|
|
// update state
|
|
|
|
void update(void);
|
2012-11-11 11:25:29 -04:00
|
|
|
|
2014-06-27 01:03:47 -03:00
|
|
|
private:
|
|
|
|
// start a reading
|
|
|
|
static bool start_reading(void);
|
|
|
|
static bool get_reading(uint16_t &reading_cm);
|
2012-11-11 11:25:29 -04:00
|
|
|
};
|