Skip to content

Commit dac44da

Browse files
committed
docs: Add documentation for ScanResults class.
1 parent 50ce02b commit dac44da

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

libraries/Camera/src/camera.h

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,23 @@ class ImageSensor {
310310
}
311311
};
312312

313-
template <typename T> class ScanResults {
313+
314+
/**
315+
* @class ScanResults
316+
* @brief A template class used to store the results from an I2C scan.
317+
*
318+
* @param T Data type for the device address (e.g. uint8_t)
319+
*/
320+
template <typename T>
321+
class ScanResults {
314322
public:
323+
/**
324+
* @brief Equality operator to check if a given device address is found in the ScanResults.
325+
*
326+
* @param toBeFound The device address to be checked
327+
* @return true If the device address is found in the ScanResults
328+
* @return false Otherwise
329+
*/
315330
bool operator==(T toBeFound) {
316331
for (int i = 0; i < howMany; i++) {
317332
if (toBeFound == data[i]) {
@@ -320,15 +335,30 @@ template <typename T> class ScanResults {
320335
}
321336
return false;
322337
}
338+
339+
/**
340+
* @brief Inequality operator to check if a given device address is not found in the ScanResults.
341+
*
342+
* @param toBeFound The device address to be checked
343+
* @return true If the device address is not found in the ScanResults
344+
* @return false Otherwise
345+
*/
323346
bool operator!=(T toBeFound) {
324347
return !(*this == toBeFound);
325348
}
349+
350+
/**
351+
* @brief Add a device address to the ScanResults.
352+
*
353+
* @param obj The device address to be added
354+
*/
326355
void push(T obj) {
327356
data[howMany++] = obj;
328357
}
358+
329359
private:
330-
T data[20];
331-
int howMany = 0;
360+
T data[20]; /// Array to store the device addresses (max 20).
361+
int howMany = 0; /// Number of device addresses in the ScanResults
332362
};
333363

334364

0 commit comments

Comments
 (0)