Permalink
Switch branches/tags
v2.4 pre-apm2-support cellular-modem-0.5 cellular-modem-0-5 Rudder_elevon Copter-3.5.0-rc2 Copter-3.5.0-rc1 Copter-3.4.6 Copter-3.4.5 Copter-3.4.4 Copter-3.4.3 Copter-3.4.3-rc1 Copter-3.4.2 Copter-3.4.2-rc2 Copter-3.4.2-rc1 Copter-3.4.1 Copter-3.4.0 Copter-3.3.2 Copter-3.3.1 Copter-3.3-rc7 Copter-3.3-rc5 CanberraUAV-OBC-2012 ArduSub-beta ArduPlane-stable ArduPlane-stable-AVR ArduPlane-beta ArduPlane-beta-AVR ArduPlane-3.7.1 ArduPlane-3.7.0 ArduPlane-3.7.0-beta1 ArduPlane-3.6.0 ArduPlane-3.5.3 ArduPlane-3.5.2 ArduPlane-3.5.1 ArduPlane-3.4.0 ArduPlane-3.3.0 ArduPlane-3.2.2 ArduPlane-3.2.1 ArduPlane-3.2.0 ArduPlane-3.1.0 ArduPlane-3.0.3 ArduPlane-3.0.2 ArduPlane-3.0.1 ArduPlane-3.0.0 ArduPlane-2.78 ArduPlane-2.78b ArduPlane-2.75 ArduPlane-2.74 ArduPlane-2.74b ArduPlane-2.73 ArduPlane-2.72 ArduPlane-2.70 ArduPlane-2.69 ArduPlane-2.68 ArduPlane-2.67 ArduPlane-2.66 ArduPlane-2.65 ArduPlane-2.64 ArduPlane-2.63 ArduPlane-2.62 ArduPlane-2.61 ArduPlane-2.60 ArduPlane-2.50 ArduPlane-2.40 ArduPlane-2.40-beta ArduPlane-2.34 ArduPlane-2.33 ArduPlane-2.32 ArduPlane-2.31 ArduPlane-2.30 ArduPlane-2.28 ArduPlane-2.27-Alpha ArduCopter-stable ArduCopter-stable-heli ArduCopter-stable-apm2 ArduCopter-stable-apm1 ArduCopter-beta ArduCopter-beta-heli ArduCopter-beta-apm2 ArduCopter-beta-apm1 ArduCopter-3.5.0-rc3 ArduCopter-3.2.1-apm-px4 ArduCopter-3.2-apm-px4 ArduCopter-3.1.5 ArduCopter-3.1.5-apm ArduCopter-3.1.0 ArduCopter-3.1.0-rc8 ArduCopter-3.1.0-rc7 ArduCopter-3.1.0-rc6 ArduCopter-3.1.0-rc5 ArduCopter-3.1.0-rc4 ArduCopter-3.1.0-rc3 ArduCopter-3.1.0-rc2 ArduCopter-3.1.0-rc1 ArduCopter-3.0.1-rc2 ArduCopter-3.0.1-rc1 ArduCopter-3.0-rc5 ArduCopter-3.0-rc4 ArduCopter-3.0-rc3 ArduCopter-3.0-rc2
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (40 sloc) 1.79 KB
#pragma once
#include "RangeFinder.h"
#include "RangeFinder_Backend.h"
#include <AP_HAL/I2CDevice.h>
/* Connection diagram
*
* ------------------------------------------------------------------------------------
* | J2-1(LED) J2-2(5V) J2-3(Enable) J2-4(Ref Clk) J2-5(GND) J2-6(GND) |
* | |
* | |
* | J1-3(I2C Clk) J1-2(I2C Data) J1-1(GND) |
* ------------------------------------------------------------------------------------
*/
class AP_RangeFinder_PulsedLightLRF : public AP_RangeFinder_Backend
{
public:
// static detection function
static AP_RangeFinder_Backend *detect(uint8_t bus, RangeFinder &ranger, uint8_t instance,
RangeFinder::RangeFinder_State &_state,
RangeFinder::RangeFinder_Type rftype);
// update state
void update(void) override {}
private:
// constructor
AP_RangeFinder_PulsedLightLRF(uint8_t bus, RangeFinder &ranger, uint8_t instance,
RangeFinder::RangeFinder_State &_state,
RangeFinder::RangeFinder_Type rftype);
// start a reading
bool init(void);
void timer(void);
bool lidar_transfer(const uint8_t *send, unsigned send_len, uint8_t *recv, unsigned recv_len);
AP_HAL::OwnPtr<AP_HAL::I2CDevice> _dev;
uint8_t sw_version;
uint8_t hw_version;
uint8_t check_reg_counter;
bool v2_hardware;
uint16_t last_distance_cm;
RangeFinder::RangeFinder_Type rftype;
enum { PHASE_MEASURE, PHASE_COLLECT } phase;
};