#ifndef NRA15_H #define NRA15_H #include // Pin number for UART #define NRA15_RX_PIN 16 // ESP32 RX <- NRA15 TX (yellow) #define NRA15_TX_PIN 17 // ESP32 TX -> NRA15 RX (white) // Max distance for NRA-15 in cm #define RANGEFINDER_NRA15_MAX_DISTANCE 10000 // 100m = 10000cm // Uncomment to use HardwareSerial instead of SoftwareSerial // #define NRA15_USE_HARDWARE_SERIAL #ifndef NRA15_USE_HARDWARE_SERIAL #include #endif /** * @brief The NRA15 class represents an NRA-15 radar device. * * This class provides methods to communicate with NRA-15 radar * and send data via MAVLink protocol. */ class NRA15 { public: /** * @brief Default constructor */ NRA15() {} /** * @brief Destructor */ ~NRA15(); /** * @brief Task function for handling NRA-15 data reception. * * @param pvParameters Pointer to task parameters (TaskCreator) */ static void NRA15RxTask(void *pvParameters); /** * @brief Variable to store the distance measured (in meters) */ static double distance; private: /** * @brief Universal pointer to Serial (works for both Hardware and Software) */ static Stream *serial; #ifndef NRA15_USE_HARDWARE_SERIAL /** * @brief Pointer to SoftwareSerial object (only when using SoftwareSerial) */ static SoftwareSerial *softSerial; #endif }; #endif // NRA15_H