Skip to content

Commit a5beddd

Browse files
committed
Doxy/Clang
1 parent 31cf086 commit a5beddd

File tree

6 files changed

+96
-13
lines changed

6 files changed

+96
-13
lines changed

src/components/gps/hardware.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ void GPSHardware::I2cReadDiscard() {
5656

5757
/*!
5858
* @brief Handles a GPSConfig message from the protobuf stream.
59-
* @param stream
60-
* Pointer to a pb_istream_t object.
59+
* @param gps_config
60+
* Pointer to a wippersnapper_gps_GPSConfig message.
6161
* @returns True if the message was handled successfully, False otherwise.
6262
*/
6363
bool GPSHardware::Handle_GPSConfig(wippersnapper_gps_GPSConfig *gps_config) {

src/components/gps/hardware.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,36 @@
3636
class Wippersnapper_V2; ///< Forward declaration
3737
class UARTHardware; ///< Forward declaration
3838

39+
/**
40+
* @brief Type of interface used by GPS.
41+
*/
3942
enum GpsInterfaceType {
4043
GPS_IFACE_NONE, ///< No interface/undefined
4144
GPS_IFACE_UART_HW, ///< UART hardware interface
4245
GPS_IFACE_UART_SW, ///< UART software interface
4346
GPS_IFACE_I2C ///< I2C interface
44-
}; ///< Type of interface used by GPS
47+
};
4548

49+
/**
50+
* @brief Type of GPS driver used.
51+
*/
4652
enum GpsDriverType {
4753
GPS_DRV_NONE, ///< No driver/undefined
4854
GPS_DRV_MTK, ///< MediaTek GPS driver
4955
GPS_DRV_UBLOX, ///< u-blox GPS driver
5056
GPS_DRV_GENERIC_NMEA ///< Generic NMEA GPS driver
51-
}; ///< Type of GPS driver used
57+
};
5258

59+
/**
60+
* @brief NMEA sentence ring buffer (FIFO).
61+
*/
5362
typedef struct {
54-
char sentences[MAX_NMEA_SENTENCES][MAX_LEN_NMEA_SENTENCE];
55-
int head;
56-
int tail;
57-
int maxlen;
58-
} nmea_buffer_t; ///< NMEA sentence ring buffer structure
63+
char sentences[MAX_NMEA_SENTENCES]
64+
[MAX_LEN_NMEA_SENTENCE]; ///< Array of NMEA sentences
65+
int head; ///< Index of the head of the buffer
66+
int tail; ///< Index of the tail of the buffer
67+
int maxlen; ///< Maximum number of sentences the buffer can hold
68+
} nmea_buffer_t;
5969

6070
/*!
6171
@brief Low-level hardware interface for WipperSnapper's generic GPS
@@ -93,7 +103,6 @@ class GPSHardware {
93103
void ReadDiscardBuffer();
94104
void PollStoreSentences();
95105
bool ParseNMEASentence(char *sentence);
96-
void HandleNmeaChar(char incoming);
97106
// Datetime getters
98107
uint8_t GetHour();
99108
uint8_t GetMinute();

src/components/gps/model.cpp

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ wippersnapper_gps_GPSConfig *GPSModel::GetGPSConfigMsg() {
5151

5252
/*!
5353
* @brief Creates a new GPSEvent message and initializes it.
54-
* @NOTE: This function will clear an existing GPSEvent message. Only call when
54+
* This function will clear an existing GPSEvent message. Only call when
5555
* you are creating a NEW gps event, not modifying an existing one.
5656
*/
5757
void GPSModel::CreateGPSEvent() {
@@ -113,6 +113,21 @@ GPSModel::CreateGpsDatetime(uint8_t hour, uint8_t minute, uint8_t seconds,
113113
return datetime;
114114
}
115115

116+
/*!
117+
* @brief Adds an RMC response to the GPSEvent message.
118+
* @param datetime A wippersnapper_gps_GPSDateTime message representing the
119+
* date and time.
120+
* @param fix_status The fix status (1 = valid, 0 = invalid).
121+
* @param lat Latitude in decimal degrees.
122+
* @param lat_dir Pointer to a string representing latitude direction ("N" or
123+
* "S").
124+
* @param lon Longitude in decimal degrees.
125+
* @param lon_dir Pointer to a string representing longitude direction ("E" or
126+
* "W").
127+
* @param speed Speed over ground in knots.
128+
* @param angle Course/heading angle in degrees.
129+
* @returns True if the RMC response was added successfully, False otherwise.
130+
*/
116131
bool GPSModel::AddGpsEventRMC(wippersnapper_gps_GPSDateTime datetime,
117132
uint8_t fix_status, float lat, char *lat_dir,
118133
float lon, char *lon_dir, float speed,
@@ -154,6 +169,23 @@ bool GPSModel::AddGpsEventRMC(wippersnapper_gps_GPSDateTime datetime,
154169
return true;
155170
}
156171

172+
/*!
173+
* @brief Adds a GGA response to the GPSEvent message.
174+
* @param datetime A wippersnapper_gps_GPSDateTime message representing the
175+
* date and time.
176+
* @param fix_status The fix status (1 = valid, 0 = invalid).
177+
* @param lat Latitude in decimal degrees.
178+
* @param lat_dir Pointer to a string representing latitude direction ("N" or
179+
* "S").
180+
* @param lon Longitude in decimal degrees.
181+
* @param lon_dir Pointer to a string representing longitude direction ("E" or
182+
* "W").
183+
* @param num_sats Number of satellites in use.
184+
* @param hdop Horizontal dilution of precision.
185+
* @param alt Altitude in meters above mean sea level.
186+
* @param geoid_height Geoid height in meters.
187+
* @returns True if the GGA response was added successfully, False otherwise.
188+
*/
157189
bool GPSModel::AddGpsEventGGA(wippersnapper_gps_GPSDateTime datetime,
158190
uint8_t fix_status, float lat, char *lat_dir,
159191
float lon, char *lon_dir, uint8_t num_sats,
@@ -194,6 +226,12 @@ bool GPSModel::AddGpsEventGGA(wippersnapper_gps_GPSDateTime datetime,
194226
return true;
195227
}
196228

229+
/*!
230+
* @brief Processes an NMEA sentence and adds it to the GPSEvent message.
231+
* @param sentence Pointer to the NMEA sentence string.
232+
* @param drv Pointer to the GPSHardware driver instance.
233+
* @returns True if the sentence was processed successfully, False otherwise.
234+
*/
197235
bool GPSModel::ProcessNMEASentence(char *sentence, GPSHardware *drv) {
198236
// Check for prefix: $GP or $GN
199237
if (strncmp(sentence, "$GP", 3) != 0 && strncmp(sentence, "$GN", 3) != 0)

src/components/uart/drivers/drvUartBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class drvUartBase {
2929
public:
3030
/*!
3131
@brief Instantiates a UART device.
32-
@param HardwareSerial
32+
@param hw_serial
3333
Pointer to a HardwareSerial instance.
3434
@param driver_name
3535
The name of the driver.

src/components/uart/drivers/drvUartUs100.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,21 @@
3131

3232
class UARTDevice {
3333
public:
34+
/*!
35+
@brief Instantiates a UARTDevice object.
36+
@param serial
37+
Pointer to a Stream instance (HardwareSerial or SoftwareSerial).
38+
*/
3439
UARTDevice(Stream *serial) { _serial_dev = serial; }
40+
/*!
41+
@brief Destructor for a UARTDevice object.
42+
*/
3543
~UARTDevice() { /* no-op destructor */ }
3644

45+
/*!
46+
@brief Creates the Adafruit_GenericDevice instance.
47+
@returns True if created successfully, False otherwise.
48+
*/
3749
bool CreateDevice() {
3850
if (_generic_dev != nullptr) {
3951
return false; // already initialized
@@ -42,12 +54,32 @@ class UARTDevice {
4254
return _generic_dev->begin();
4355
}
4456

57+
/*!
58+
@brief Destroys the Adafruit_GenericDevice instance.
59+
@param thiz
60+
Pointer to the UARTDevice instance.
61+
@param buffer
62+
Pointer to the buffer containing data to write.
63+
@param len
64+
Number of bytes to write.
65+
@returns True if written successfully, False otherwise.
66+
*/
4567
static bool uart_write(void *thiz, const uint8_t *buffer, size_t len) {
4668
UARTDevice *dev = (UARTDevice *)thiz;
4769
dev->_serial_dev->write(buffer, len);
4870
return true;
4971
}
5072

73+
/*!
74+
@brief Reads data from the UART device.
75+
@param thiz
76+
Pointer to the UARTDevice instance.
77+
@param buffer
78+
Pointer to the buffer to store read data.
79+
@param len
80+
Number of bytes to read.
81+
@returns True if read successfully, False otherwise.
82+
*/
5183
static bool uart_read(void *thiz, uint8_t *buffer, size_t len) {
5284
UARTDevice *dev = (UARTDevice *)thiz;
5385
uint16_t timeout = 100;
@@ -63,6 +95,10 @@ class UARTDevice {
6395
return true;
6496
}
6597

98+
/*!
99+
@brief Gets the GenericDevice instance.
100+
@returns Pointer to the Adafruit_GenericDevice instance.
101+
*/
66102
Adafruit_GenericDevice *getGenericDevice() { return _generic_dev; }
67103

68104
private:

src/components/uart/model.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define WS_UART_MODEL_H
1717
#include "Wippersnapper_V2.h"
1818
#include <Adafruit_Sensor.h>
19-
#define MAX_UART_INPUT_EVENTS 15
19+
#define MAX_UART_INPUT_EVENTS 15 ///< Maximum number of UART input events
2020

2121
/*!
2222
@brief Provides an interface for creating, encoding, and parsing

0 commit comments

Comments
 (0)