File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ static int32_t battery_voltage_avg_scaled;
21
21
// to reduce rounding errors in the moving average.
22
22
#define SCALE (1024)
23
23
24
- // Initializes average to first measurement.
24
+ /**
25
+ * Initializes battery voltage state to first measurement.
26
+ *
27
+ * @return Error code.
28
+ */
25
29
pbio_error_t pbio_battery_init (void ) {
26
30
27
31
// Get battery voltage.
@@ -37,7 +41,11 @@ pbio_error_t pbio_battery_init(void) {
37
41
return PBIO_SUCCESS ;
38
42
}
39
43
40
- // Updates the average voltage.
44
+ /**
45
+ * Updates the average voltage using a new measurement.
46
+ *
47
+ * @return Error code.
48
+ */
41
49
pbio_error_t pbio_battery_update (void ) {
42
50
43
51
// Get battery voltage.
@@ -53,7 +61,11 @@ pbio_error_t pbio_battery_update(void) {
53
61
return PBIO_SUCCESS ;
54
62
}
55
63
56
- // Gets the moving average value.
64
+ /**
65
+ * Gets the moving average battery voltage.
66
+ *
67
+ * @return The voltage in mV.
68
+ */
57
69
int32_t pbio_battery_get_average_voltage (void ) {
58
70
return battery_voltage_avg_scaled / SCALE ;
59
71
}
You can’t perform that action at this time.
0 commit comments