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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "AP_RangeFinder_config.h"
       4             : 
       5             : #if AP_RANGEFINDER_TOFSENSEF_I2C_ENABLED
       6             : 
       7             : #include "AP_RangeFinder.h"
       8             : #include "AP_RangeFinder_Backend_I2C.h"
       9             : 
      10             : #define TOFSENSEP_I2C_DEFAULT_ADDR   0x08
      11             : 
      12             : class AP_RangeFinder_TOFSenseF_I2C : public AP_RangeFinder_Backend_I2C
      13             : {
      14             : public:
      15             :     // static detection function
      16           1 :     static AP_RangeFinder_Backend *detect(RangeFinder::RangeFinder_State &_state,
      17             :                                           AP_RangeFinder_Params &_params,
      18             :                                           class AP_HAL::I2CDevice &dev) {
      19             :         // this will free the object if configuration fails:
      20           1 :         return configure(NEW_NOTHROW AP_RangeFinder_TOFSenseF_I2C(_state, _params, dev));
      21             :     }
      22             : 
      23             :     // update state
      24             :     void update(void) override;
      25             : 
      26             : protected:
      27             : 
      28         336 :     MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
      29         336 :         return MAV_DISTANCE_SENSOR_LASER;
      30             :     }
      31             : 
      32             : private:
      33             :     // constructor
      34             :     using AP_RangeFinder_Backend_I2C::AP_RangeFinder_Backend_I2C;
      35             : 
      36             :     bool init(void) override;
      37             :     void timer(void);
      38             : 
      39             :     uint32_t distance_mm;
      40             :     bool new_distance; // true if we have a new distance
      41             : 
      42             :     // get a reading
      43             :     bool start_reading(void);
      44             :     bool get_reading(uint32_t &reading_mm, uint16_t &signal_strength, uint16_t &status);
      45             : };
      46             : 
      47             : #endif  // AP_RANGEFINDER_TOFSENSEF_I2C_ENABLED

Generated by: LCOV version 1.14