File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,9 @@ namespace zest {
77/* *
88 * @brief Smart Port class. Represents a Smart Port on the V5 brain.
99 *
10- * @details Smart Ports may be represented as a 1-indexed number or a 0-indexed number. While the
10+ * Smart Ports may be represented as a 1-indexed number or a 0-indexed number. While the
1111 * user expects a 1-indexed number (matching the labels on the brain), treating it as an index makes
1212 * development easier. This class abstracts that away so we don't have to worry about it.
13- *
1413 */
1514class SmartPort {
1615 public:
@@ -71,6 +70,13 @@ class SmartPort {
7170};
7271
7372namespace ports {
73+ /*
74+ * Physical smart ports have a number from 1 to 21 (inclusive). While compile-time error checking
75+ * could prevent an invalid port being constructed, the error messages that would be produced
76+ * wouldn't be very concise.
77+ * However, if the user tried constructing a device on the imaginary port 42, the project wouldn't
78+ * compile since PORT_42 isn't declared. This error message is much clearer.
79+ */
7480constexpr auto PORT_1 = SmartPort::from_number(1 );
7581constexpr auto PORT_2 = SmartPort::from_number(2 );
7682constexpr auto PORT_3 = SmartPort::from_number(3 );
You can’t perform that action at this time.
0 commit comments