@@ -35,39 +35,97 @@ class sfeDevSoilMoisture
35
35
{
36
36
}
37
37
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
+ */
41
48
sfeTkError_t begin (sfeTkIBus *theBus = nullptr );
42
49
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
+ */
45
61
sfeTkError_t LEDOff (void );
46
62
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
+ */
49
74
sfeTkError_t LEDOn (void );
50
75
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
+ */
53
86
uint16_t readMoistureValue (void );
54
87
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
+ */
57
97
float readMoistureRatio (void );
58
98
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
+ */
61
107
float readMoisturePercentage (void );
62
108
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
+ */
67
119
sfeTkError_t setI2CAddress (uint8_t newAddress);
68
120
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
+ */
71
129
uint8_t address (void );
72
130
73
131
protected:
0 commit comments