LCOV - code coverage report
Current view: top level - AP_RangeFinder - AP_RangeFinder_PulsedLightLRF.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 3 0.0 %
Date: 2026-09-09 11:02:08 Functions: 0 2 0.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "AP_RangeFinder_config.h"
       4             : 
       5             : #if AP_RANGEFINDER_PULSEDLIGHTLRF_ENABLED
       6             : 
       7             : #include "AP_RangeFinder.h"
       8             : #include "AP_RangeFinder_Backend.h"
       9             : 
      10             : #include <AP_HAL/I2CDevice.h>
      11             : 
      12             : /* Connection diagram
      13             :  *
      14             :  *        ------------------------------------------------------------------------------------
      15             :  *        |           J2-1(LED) J2-2(5V) J2-3(Enable) J2-4(Ref Clk) J2-5(GND) J2-6(GND)      |
      16             :  *        |                                                                                  |
      17             :  *        |                                                                                  |
      18             :  *        |                                      J1-3(I2C Clk) J1-2(I2C Data) J1-1(GND)      |
      19             :  *        ------------------------------------------------------------------------------------
      20             :  */
      21             : 
      22             : class AP_RangeFinder_PulsedLightLRF : public AP_RangeFinder_Backend
      23             : {
      24             : 
      25             : public:
      26             :     // static detection function
      27             :     static AP_RangeFinder_Backend *detect(uint8_t bus,
      28             :                                           RangeFinder::RangeFinder_State &_state,
      29             :                                           AP_RangeFinder_Params &_params,
      30             :                                           RangeFinder::Type rftype);
      31             : 
      32             :     // update state
      33           0 :     void update(void) override {}
      34             : 
      35             : protected:
      36             : 
      37           0 :     virtual MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
      38           0 :         return MAV_DISTANCE_SENSOR_LASER;
      39             :     }
      40             : 
      41             : private:
      42             :     // constructor
      43             :     AP_RangeFinder_PulsedLightLRF(uint8_t bus,
      44             :                                   RangeFinder::RangeFinder_State &_state,
      45             :                                                                   AP_RangeFinder_Params &_params,
      46             :                                   RangeFinder::Type rftype);
      47             : 
      48             :     // start a reading
      49             :     bool init(void);
      50             :     void timer(void);
      51             :     bool lidar_transfer(const uint8_t *send, unsigned send_len, uint8_t *recv, unsigned recv_len);
      52             :     
      53             :     AP_HAL::OwnPtr<AP_HAL::I2CDevice> _dev;
      54             : 
      55             :     uint8_t sw_version;
      56             :     uint8_t hw_version;
      57             :     uint8_t check_reg_counter;
      58             :     bool v2_hardware;
      59             :     bool v3hp_hardware;
      60             :     uint16_t last_distance_cm;
      61             :     RangeFinder::Type rftype;
      62             :     
      63             :     enum { PHASE_MEASURE, PHASE_COLLECT } phase;
      64             : };
      65             : 
      66             : #endif  // AP_RANGEFINDER_PULSEDLIGHTLRF_ENABLED

Generated by: LCOV version 1.14