Line data Source code
1 : #pragma once 2 : 3 : #include "AP_RangeFinder_config.h" 4 : 5 : #if AP_RANGEFINDER_ENABLED 6 : 7 : #include "AP_RangeFinder.h" 8 : #include "AP_RangeFinder_Backend.h" 9 : #include <AP_HAL/I2CDevice.h> 10 : 11 : class AP_RangeFinder_Backend_I2C : public AP_RangeFinder_Backend 12 : { 13 : public: 14 : 15 : protected: 16 : 17 : // constructor 18 21 : AP_RangeFinder_Backend_I2C( 19 : RangeFinder::RangeFinder_State &_state, 20 : AP_RangeFinder_Params &_params, 21 : AP_HAL::I2CDevice &_dev) 22 21 : : AP_RangeFinder_Backend(_state, _params) 23 21 : , dev(_dev) 24 21 : { } 25 : 26 : // configures the rangefinder, deletes it if unable to init it. 27 : static AP_RangeFinder_Backend_I2C *configure(AP_RangeFinder_Backend_I2C *); 28 : 29 : AP_HAL::I2CDevice &dev; 30 : 31 : virtual bool init() = 0; 32 : }; 33 : 34 : #endif // AP_RANGEFINDER_ENABLED