doxygen and clang

This commit is contained in:
brentru 2025-07-21 11:13:53 -04:00
parent 5eb550766a
commit 569ff1495e
4 changed files with 51 additions and 39 deletions

View file

@ -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)

View file

@ -22,14 +22,20 @@
#include <Stream.h>
// UBX protocol constants
#define UBX_SYNC_CHAR_1 0xB5 // First UBX protocol sync char (<28>)
#define UBX_SYNC_CHAR_2 0x62 // Second UBX protocol sync char (b)
#define UBX_SYNC_CHAR_1 0xB5 ///< First UBX protocol sync char (<28>)
#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

View file

@ -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:
* <a href="https://github.com/adafruit/Adafruit_BusIO">Adafruit_BusIO</a>
*
* @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
*/

View file

@ -17,7 +17,7 @@
#include <Arduino.h>
// 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