Line data Source code
1 : #pragma once 2 : 3 : #include "AP_RangeFinder_config.h" 4 : 5 : #if AP_RANGEFINDER_NOOPLOOP_ENABLED 6 : 7 : #include "AP_RangeFinder.h" 8 : #include "AP_RangeFinder_Backend_Serial.h" 9 : 10 : class AP_RangeFinder_NoopLoop : public AP_RangeFinder_Backend_Serial 11 : { 12 : 13 : public: 14 1 : static AP_RangeFinder_Backend_Serial *create( 15 : RangeFinder::RangeFinder_State &_state, 16 : AP_RangeFinder_Params &_params) { 17 1 : return NEW_NOTHROW AP_RangeFinder_NoopLoop(_state, _params); 18 : } 19 : 20 : protected: 21 : 22 341 : virtual MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override { 23 341 : return MAV_DISTANCE_SENSOR_LASER; 24 : } 25 : 26 : private: 27 : using AP_RangeFinder_Backend_Serial::AP_RangeFinder_Backend_Serial; 28 : 29 : 30 : // get a reading 31 : // distance returned in reading_m 32 : bool get_reading(float &reading_m) override; 33 : 34 : uint8_t linebuf[16]; 35 : uint8_t linebuf_len; 36 : }; 37 : 38 : #endif // AP_RANGEFINDER_NOOPLOOP_ENABLED