@@ -25,13 +25,18 @@ namespace sdk {
25
25
// / specific board implementations. This class cannot be used on its own.
26
26
class Board : public Component {
27
27
public:
28
- // / @brief Represents the value received by the registered analog to digital converter (ADC).
29
- // / The range and conversion mechanism to voltage will vary depending on the specific ADC
30
- // / registered to the pin, though the min and max voltages and step_size can often help with
31
- // / this conversion. Consult your ADC's documentation and Viam's `Board` documentation for
32
- // / more details.
33
- struct analog_value {
34
- int32_t value;
28
+ // / @brief Represents the raw value received by the registered analog to digital converter
29
+ // / (ADC). The range and conversion mechanism to voltage will vary depending on the specific
30
+ // / ADC registered to the pin.
31
+ using analog_value = int32_t ;
32
+
33
+ // / @brief Represents the response received when reading the registered analog to digital
34
+ // / converter (ADC). The range and conversion mechanism to voltage will vary depending on the
35
+ // / specific ADC registered to the pin, though the min and max voltages and step_size can often
36
+ // / help with this conversion. Consult your ADC's documentation and Viam's `Board`
37
+ // / documentation for more details.
38
+ struct analog_response {
39
+ analog_value value;
35
40
float min_range; // Minimum possible voltage read by the analog reader
36
41
float max_range; // Maximum possible voltage read by the analog reader
37
42
float step_size; // Volts represented in each step in the value
@@ -166,16 +171,16 @@ class Board : public Component {
166
171
// / @brief Reads off the current value of an analog reader on a board. Consult your ADC's docs
167
172
// / or Viam's `Board` docs for more information.
168
173
// / @param analog_reader_name analog reader to read from
169
- inline analog_value read_analog (const std::string& analog_reader_name) {
174
+ inline analog_response read_analog (const std::string& analog_reader_name) {
170
175
return read_analog (analog_reader_name, {});
171
176
}
172
177
173
178
// / @brief Reads off the current value of an analog reader on a board. Consult your ADC's docs
174
179
// / or Viam's `Board` docs for more information.
175
180
// / @param analog_reader_name analog reader to read from
176
181
// / @param extra Any additional arguments to the method
177
- virtual analog_value read_analog (const std::string& analog_reader_name,
178
- const AttributeMap& extra) = 0;
182
+ virtual analog_response read_analog (const std::string& analog_reader_name,
183
+ const AttributeMap& extra) = 0;
179
184
180
185
// / @brief Writes the value to the analog writer of the board.
181
186
// / @param pin the pin to write to
@@ -267,7 +272,6 @@ struct API::traits<Board> {
267
272
};
268
273
269
274
bool operator ==(const Board::status& lhs, const Board::status& rhs);
270
- bool operator ==(const Board::analog_value& lhs, const Board::analog_value& rhs);
271
275
272
276
} // namespace sdk
273
277
} // namespace viam
0 commit comments