Skip to content

Commit 7a0b1ba

Browse files
dok-netblemasle
andauthored
Add enumeration with pin values for digitalWrite etc (#28)
* Add enumeration with pin values for digitalWrite etc * It is recommended not to use enum class if implicit cast to value is required. C++23 is said to provide a standard library helper, until then, for scoping, wrapping in a struct is recommended. Co-authored-by: Bertrand Lemasle <[email protected]>
1 parent af72278 commit 7a0b1ba

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/MCP23017.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ enum class MCP23017Port : uint8_t
1212
B = 1
1313
};
1414

15+
struct MCP23017Pin
16+
{
17+
enum Names {
18+
GPA0 = 0,
19+
GPA1,
20+
GPA2,
21+
GPA3,
22+
GPA4,
23+
GPA5,
24+
GPA6,
25+
GPA7,
26+
GPB0 = 8,
27+
GPB1,
28+
GPB2,
29+
GPB3,
30+
GPB4,
31+
GPB5,
32+
GPB6,
33+
GPB7
34+
};
35+
};
36+
1537
/**
1638
* Controls if the two interrupt pins mirror each other.
1739
* See "3.6 Interrupt Logic".

0 commit comments

Comments
 (0)