@@ -35,39 +35,97 @@ class sfeDevSoilMoisture
3535 {
3636 }
3737
38- // / @brief Start the driver/begin connecting/comms to the device
39- // / @param theBus A pointer to an I2C toolkit object
40- // / @return kSTkErrOk if successful, otherwise an error code
38+ /* *
39+ * @brief Initializes communication with the soil moisture sensor
40+ *
41+ * This function must be called before any other methods. It establishes
42+ * communication with the sensor using the provided I2C bus interface.
43+ *
44+ * @param theBus Pointer to an I2C toolkit object. If nullptr, uses previously set bus
45+ * @return kSTkErrOk if initialization succeeds
46+ * @return kSTkErrBusNotInit if no valid bus interface is provided
47+ */
4148 sfeTkError_t begin (sfeTkIBus *theBus = nullptr );
4249
43- // / @brief Turns off the on-board LED
44- // / @return kSTkErrOk if successful, otherwise an error code
50+ /* *
51+ * @brief Turns off the on-board LED
52+ *
53+ * Disables the sensor's built-in LED
54+ *
55+ * @return kSTkErrOk if LED was successfully turned off
56+ * @return kSTkErrBusNotInit if no bus interface is configured
57+ * @return kSTkErrFail if sensor doesn't respond or a communication error occurs
58+ *
59+ * @see LEDOn()
60+ */
4561 sfeTkError_t LEDOff (void );
4662
47- // / @brief Turns on the on-board LED
48- // / @return kSTkErrOk if successful, otherwise an error code
63+ /* *
64+ * @brief Turns on the on-board LED
65+ *
66+ * Enables the sensor's built-in LED by sending the appropriate command
67+ *
68+ * @return kSTkErrOk if LED was successfully turned on
69+ * @return kSTkErrBusNotInit if no bus interface is configured
70+ * @return kSTkErrFail if sensor doesn't respond or a communication error occurs
71+ *
72+ * @see LEDOff()
73+ */
4974 sfeTkError_t LEDOn (void );
5075
51- // / @brief Reads the moisture value from the sensor
52- // / @return The moisture value - a resistance reading between 0 and 1023
76+ /* *
77+ * @brief Reads the moisture value from the sensor
78+ *
79+ * This function reads the raw moisture value from the sensor, which is a
80+ * resistance reading between 0 and 1023.
81+ *
82+ * @return The moisture value - a resistance reading between 0 and 1023
83+ * @note A value of 0 indicates a wet sensor, while 1023 indicates a dry sensor
84+ * @note On error, this method returns 0
85+ */
5386 uint16_t readMoistureValue (void );
5487
55- // / @brief Reads the sensor value and returns the moisture ratio from the sensor (0 - 1.0)
56- // / @return The moisture ratio
88+ /* *
89+ * @brief Reads the sensor value and returns the moisture ratio from the sensor
90+ *
91+ * This function reads the raw moisture value from the sensor and converts it
92+ * to a ratio between 0 and 1.0.
93+ *
94+ * @return The moisture ratio, where 0 indicates a dry sensor and 1.0 indicates a wet sensor
95+ * @note On error, this method returns 0
96+ */
5797 float readMoistureRatio (void );
5898
59- // / @brief Reads the sensor value and returns the moisture percentage from the sensor (0 - 100%)
60- // / @return The moisture percentage
99+ /* *
100+ * @brief Reads the sensor value and returns the moisture percentage from the sensor
101+ *
102+ * This function reads the raw moisture value from the sensor and converts it
103+ * to a percentage between 0 and 100%.
104+ *
105+ * @return The moisture percentage, where 0% indicates a dry sensor and 100% indicates a wet sensor
106+ */
61107 float readMoisturePercentage (void );
62108
63- // / @brief Changes the I2C address of the sensor
64- // / @param newAddress The new I2C address to assign to the sensor
65- // / @return kSTkErrOk if successful, otherwise an error code
66- // / @note If communicating via I2C, the provided address is used for future communication
109+ /* *
110+ * @brief Changes the I2C address of the sensor
111+ *
112+ * This function sets a new I2C address for the sensor. The new address will be used
113+ * for all future I2C communication with the sensor. This value is persistent
114+ *
115+ * @param newAddress The new I2C address to assign to the sensor
116+ * @return kSTkErrOk if successful, otherwise an error code
117+ * @note If communicating via I2C, the provided address is used for future I2C communication
118+ */
67119 sfeTkError_t setI2CAddress (uint8_t newAddress);
68120
69- // / @brief Returns the current address of the sensor. I2C - bus address, SPI - CS Pin
70- // @return The current I2C address of the sensor, or the CS pin for SPI
121+ /* *
122+ * @brief Returns the current address of the sensor
123+ *
124+ * This function returns the current I2C address of the sensor if using I2C,
125+ * or the Chip Select (CS) pin if using SPI.
126+ *
127+ * @return The current I2C address of the sensor, or the CS pin for SPI
128+ */
71129 uint8_t address (void );
72130
73131 protected:
0 commit comments