From 569ff1495e3ecf0f4ff3eeee843cf8fe8169c076 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 21 Jul 2025 11:13:53 -0400 Subject: [PATCH] doxygen and clang --- Adafruit_UBX.cpp | 10 +++++++++ Adafruit_UBX.h | 26 ++++++++++++++---------- Adafruit_UBloxDDC.cpp | 10 ++++----- Adafruit_uBlox_typedef.h | 44 ++++++++++++++++++++-------------------- 4 files changed, 51 insertions(+), 39 deletions(-) diff --git a/Adafruit_UBX.cpp b/Adafruit_UBX.cpp index c16b46f..c1a4b80 100644 --- a/Adafruit_UBX.cpp +++ b/Adafruit_UBX.cpp @@ -33,6 +33,16 @@ Adafruit_UBX::Adafruit_UBX(Stream &stream) { onUBXMessage = NULL; } +/*! + * @brief Destructor + */ +Adafruit_UBX::~Adafruit_UBX() { + if (_stream) + delete _stream; + if (onUBXMessage) + onUBXMessage = NULL; +} + /*! * @brief Initializes the UBX parser * @return Always returns true (initialization is trivial) diff --git a/Adafruit_UBX.h b/Adafruit_UBX.h index f6afc5e..a0cef0d 100644 --- a/Adafruit_UBX.h +++ b/Adafruit_UBX.h @@ -22,14 +22,20 @@ #include // UBX protocol constants -#define UBX_SYNC_CHAR_1 0xB5 // First UBX protocol sync char (�) -#define UBX_SYNC_CHAR_2 0x62 // Second UBX protocol sync char (b) +#define UBX_SYNC_CHAR_1 0xB5 ///< First UBX protocol sync char (�) +#define UBX_SYNC_CHAR_2 0x62 ///< Second UBX protocol sync char (b) // UBX ACK Message IDs -#define UBX_ACK_NAK 0x00 // Message Not Acknowledged -#define UBX_ACK_ACK 0x01 // Message Acknowledged +#define UBX_ACK_NAK 0x00 ///< Message Not Acknowledged +#define UBX_ACK_ACK 0x01 ///< Message Acknowledged -// Callback function type for UBX messages - defined at global scope so other -// classes can use it +/*! + * @brief Callback function type for UBX messages - defined at global scope so + * other classes can use it + * @param msgClass Message class + * @param msgId Message ID + * @param payloadLen Length of payload data + * @param payload Pointer to payload data + */ typedef void (*UBXMessageCallback)(uint8_t msgClass, uint8_t msgId, uint16_t payloadLen, uint8_t *payload); @@ -38,13 +44,11 @@ typedef void (*UBXMessageCallback)(uint8_t msgClass, uint8_t msgId, */ class Adafruit_UBX { public: - // Constructor Adafruit_UBX(Stream &stream); - uint8_t verbose_debug = 0; // 0=off, 1=basic, 2=verbose - + ~Adafruit_UBX(); + uint8_t verbose_debug = 0; ///< 0=off, 1=basic, 2=verbose // Basic methods bool begin(); - bool checkMessages(); // Message parsing bool sendMessage(uint8_t msgClass, uint8_t msgId, uint8_t *payload, uint16_t length); // Send a UBX message @@ -57,7 +61,7 @@ public: uint16_t timeout_ms = 500); void setMessageCallback(UBXMessageCallback callback); // Set callback function - UBXMessageCallback onUBXMessage; // Callback for message received + UBXMessageCallback onUBXMessage; ///< Callback for message received private: Stream *_stream; // Stream interface for reading data diff --git a/Adafruit_UBloxDDC.cpp b/Adafruit_UBloxDDC.cpp index c66d094..43e6c54 100644 --- a/Adafruit_UBloxDDC.cpp +++ b/Adafruit_UBloxDDC.cpp @@ -1,25 +1,23 @@ /*! * @file Adafruit_UBloxDDC.cpp * - * @mainpage Arduino library for u-blox GPS/RTK modules over DDC (I2C) - * - * @section intro_sec Introduction + * @section ddc_intro_sec Introduction * * This is a library for the u-blox GPS/RTK modules using I2C interface (DDC) * * Designed specifically to work with u-blox GPS/RTK modules * like NEO-M8P, ZED-F9P, etc. * - * @section dependencies Dependencies + * @section ddc_dependencies Dependencies * * This library depends on: * Adafruit_BusIO * - * @section author Author + * @section ddc_author Author * * Written by Limor Fried/Ladyada for Adafruit Industries. * - * @section license License + * @section ddc_license License * * MIT license, all text above must be included in any redistribution */ diff --git a/Adafruit_uBlox_typedef.h b/Adafruit_uBlox_typedef.h index 7c00a8d..43352eb 100644 --- a/Adafruit_uBlox_typedef.h +++ b/Adafruit_uBlox_typedef.h @@ -17,7 +17,7 @@ #include -// UBX Message Classes +/** UBX protocol message class identifiers. */ typedef enum { UBX_CLASS_NAV = 0x01, // Navigation Results UBX_CLASS_RXM = 0x02, // Receiver Manager Messages @@ -36,7 +36,7 @@ typedef enum { UBX_CLASS_NMEA = 0xF0 // NMEA Standard Messages } UBXMessageClass; -// UBX CFG Message IDs +/** UBX CFG Message IDs. */ typedef enum { UBX_CFG_PRT = 0x00, // Port Configuration UBX_CFG_MSG = 0x01, // Message Configuration @@ -48,7 +48,7 @@ typedef enum { UBX_CFG_PMS = 0x86 // Power Mode Setup } UBXCfgMessageId; -// Return values for functions that wait for acknowledgment +/** Return values for functions that wait for acknowledgment. */ typedef enum { UBX_SEND_SUCCESS = 0, // Message was acknowledged (ACK) UBX_SEND_NAK, // Message was not acknowledged (NAK) @@ -56,7 +56,7 @@ typedef enum { UBX_SEND_TIMEOUT // Timed out waiting for ACK/NAK } UBXSendStatus; -// Port ID enum for different interfaces +/** Port ID enum for different interfaces. */ typedef enum { UBX_PORT_DDC = 0, // I2C / DDC port UBX_PORT_UART1 = 1, // UART1 port @@ -65,7 +65,7 @@ typedef enum { UBX_PORT_SPI = 4 // SPI port } UBXPortId; -// UART mode flags (Charlen, Parity & Stop bit settings) +/** UART mode flags (Charlen, Parity & Stop bit settings). */ typedef enum { UBX_UART_MODE_8N1 = 0x000, // 8-bit, no parity, 1 stop bit UBX_UART_MODE_8E1 = 0x100, // 8-bit, even parity, 1 stop bit @@ -82,27 +82,27 @@ typedef enum { } UBXUARTMode; // Protocol flags for inProtoMask and outProtoMask -#define UBX_PROTOCOL_UBX 0x0001 // UBX protocol -#define UBX_PROTOCOL_NMEA 0x0002 // NMEA protocol -#define UBX_PROTOCOL_RTCM 0x0004 // RTCM2 protocol (only for inProtoMask) -#define UBX_PROTOCOL_RTCM3 0x0020 // RTCM3 protocol +#define UBX_PROTOCOL_UBX 0x0001 ///< UBX protocol +#define UBX_PROTOCOL_NMEA 0x0002 ///< NMEA protocol +#define UBX_PROTOCOL_RTCM 0x0004 ///< RTCM2 protocol (only for inProtoMask) +#define UBX_PROTOCOL_RTCM3 0x0020 ///< RTCM3 protocol -// CFG-PRT (Port Configuration) Message -// Total size: 20 bytes +/** UBX CFG-PRT (Port Configuration) message structure. 20 bytes total. + */ typedef union { struct { uint8_t - portID; // Port identifier (0=DDC/I2C, 1=UART1, 2=UART2, 3=USB, 4=SPI) - uint8_t reserved1; // Reserved - uint16_t txReady; // TX ready PIN configuration - uint32_t mode; // UART mode (bit field) or Reserved for non-UART ports - uint32_t baudRate; // Baudrate in bits/second (UART only) - uint16_t inProtoMask; // Input protocol mask - uint16_t outProtoMask; // Output protocol mask - uint16_t flags; // Flags bit field - uint16_t reserved2; // Reserved - } fields; - uint8_t raw[20]; + portID; ///< Port identifier (0=DDC/I2C, 1=UART1, 2=UART2, 3=USB, 4=SPI) + uint8_t reserved1; ///< Reserved + uint16_t txReady; ///< TX ready PIN configuration + uint32_t mode; ///< UART mode (bit field) or Reserved for non-UART ports + uint32_t baudRate; ///< Baudrate in bits/second (UART only) + uint16_t inProtoMask; ///< Input protocol mask + uint16_t outProtoMask; ///< Output protocol mask + uint16_t flags; ///< Flags bit field + uint16_t reserved2; ///< Reserved + } fields; ///< Fields for CFG-PRT message + uint8_t raw[20]; ///< Raw byte array for CFG-PRT message } UBX_CFG_PRT_t; #endif // ADAFRUIT_UBLOX_TYPEDEF_H