Line data Source code
1 : #pragma once 2 : 3 : #include "AP_Proximity_Backend.h" 4 : 5 : #if HAL_PROXIMITY_ENABLED 6 : 7 : class AP_Proximity_Backend_Serial : public AP_Proximity_Backend 8 : { 9 : public: 10 : AP_Proximity_Backend_Serial(AP_Proximity &_frontend, 11 : AP_Proximity::Proximity_State &_state, 12 : AP_Proximity_Params& _params, 13 : uint8_t serial_instance); 14 : 15 : // static detection function 16 : // detect if a proximity sensor is connected by looking for a configured serial port 17 : // serial_instance affects which serial port is used. Should be 0 or 1 depending on whether this is the 1st or 2nd proximity sensor with a serial interface 18 : static bool detect(uint8_t serial_instance); 19 : 20 : protected: 21 6 : virtual uint16_t rxspace() const { return 0; }; 22 : 23 : AP_HAL::UARTDriver *_uart; // uart for communicating with sensor 24 : }; 25 : 26 : #endif // HAL_PROXIMITY_ENABLED