@@ -36,6 +36,8 @@ class drvBase {
3636 The I2C hardware interface, default is Wire.
3737 @param address
3838 The I2C sensor's unique address.
39+ @param driver_name
40+ The name of the driver.
3941 */
4042 /* ******************************************************************************/
4143 drvBase (TwoWire *i2c, uint16_t address, const char *driver_name) {
@@ -60,6 +62,8 @@ class drvBase {
6062 @param mux_channel
6163 An optional channel number used to address a device on a I2C
6264 MUX.
65+ @param driver_name
66+ The name of the driver.
6367 */
6468 /* ******************************************************************************/
6569 drvBase (TwoWire *i2c, uint16_t address, uint32_t mux_channel,
@@ -98,16 +102,30 @@ class drvBase {
98102 /* ******************************************************************************/
99103 uint16_t GetAddress () { return _address; }
100104
105+ /* ******************************************************************************/
106+ /* !
107+ @brief Gets the I2C MUX address.
108+ @returns The I2C MUX address.
109+ */
110+ /* ******************************************************************************/
101111 uint32_t GetMuxAddress () { return _i2c_mux_addr; }
102112
113+ /* ******************************************************************************/
114+ /* !
115+ @brief Sets the I2C MUX address.
116+ @param mux_address
117+ The I2C MUX address.
118+ */
119+ /* ******************************************************************************/
103120 void SetMuxAddress (uint32_t mux_address) { _i2c_mux_addr = mux_address; }
104121
105122 /* ******************************************************************************/
106123 /* !
107124 @brief Set if the I2C driver has an alternative I2C bus.
108- @param has_alt_i2c_bus
109- True if the I2C driver requests to use an alternative I2C bus,
110- False otherwise.
125+ @param scl_pin
126+ The SCL pin for the alternative I2C bus.
127+ @param sda_pin
128+ The SDA pin for the alternative I2C bus.
111129 */
112130 /* ******************************************************************************/
113131 void EnableAltI2CBus (char *scl_pin, char *sda_pin) {
@@ -116,7 +134,20 @@ class drvBase {
116134 _has_alt_i2c_bus = true ;
117135 }
118136
137+ /* ******************************************************************************/
138+ /* !
139+ @brief Gets the SCL pin for the alternative I2C bus.
140+ @returns The SCL pin for the alternative I2C bus.
141+ */
142+ /* ******************************************************************************/
119143 const char *GetPinSCL () { return _pin_scl; }
144+
145+ /* ******************************************************************************/
146+ /* !
147+ @brief Gets the SDA pin for the alternative I2C bus.
148+ @returns The SDA pin for the alternative I2C bus.
149+ */
150+ /* ******************************************************************************/
120151 const char *GetPinSDA () { return _pin_sda; }
121152
122153 /* ******************************************************************************/
@@ -147,10 +178,10 @@ class drvBase {
147178 /* ******************************************************************************/
148179 /* !
149180 @brief Configures an i2c device's sensors.
150- @param sensors
181+ @param sensor_types
151182 Pointer to an array of SensorType objects.
152- @param count
153- The number of active sensors on the device.
183+ @param sensor_types_count
184+ The number of active sensors to read from the device.
154185 */
155186 /* ******************************************************************************/
156187 void EnableSensorReads (wippersnapper_sensor_SensorType *sensor_types,
@@ -320,6 +351,13 @@ class drvBase {
320351 return false ;
321352 }
322353
354+ /* ******************************************************************************/
355+ /* !
356+ @brief Base implementation - Selects a MUX channel for use with the
357+ I2C device.
358+ @param channel
359+ The MUX channel to select.
360+ */
323361 virtual void SelectMUXChannel (uint8_t channel) { return ; }
324362
325363 /* ******************************************************************************/
@@ -557,6 +595,17 @@ class drvBase {
557595 return false ;
558596 }
559597
598+ /* ******************************************************************************/
599+ /* !
600+ @brief Reads a sensor's event from the i2c driver.
601+ @param sensor_type
602+ The sensor type to read.
603+ @param sensors_event
604+ Pointer to an Adafruit_Sensor event.
605+ @returns True if the sensor event was obtained successfully, False
606+ otherwise.
607+ */
608+ /* ******************************************************************************/
560609 bool GetSensorEvent (wippersnapper_sensor_SensorType sensor_type,
561610 sensors_event_t *sensors_event) {
562611 auto it = SensorEventHandlers.find (sensor_type);
@@ -565,7 +614,14 @@ class drvBase {
565614 return it->second (sensors_event);
566615 }
567616
568- // Lambda function type for all GetEventX() function calls
617+ /* ******************************************************************************/
618+ /* !
619+ @brief Function type for sensor event handlers
620+ @param sensors_event_t*
621+ Pointer to the sensor event structure to be filled
622+ @returns True if event was successfully read, False otherwise
623+ */
624+ /* ******************************************************************************/
569625 using fnGetEvent = std::function<bool (sensors_event_t *)>;
570626
571627 // Maps SensorType to function calls
@@ -673,7 +729,7 @@ class drvBase {
673729 {wippersnapper_sensor_SensorType_SENSOR_TYPE_TVOC,
674730 [this ](sensors_event_t *event) -> bool {
675731 return this ->getEventTVOC (event);
676- }}};
732+ }}}; // /< SensorType to function call map
677733
678734 wippersnapper_sensor_SensorType
679735 _sensors[15 ]; // /< Sensors attached to the device.
0 commit comments