Skip to content

Commit 450c4dd

Browse files
SuGlidermrengineer7777
authored andcommitted
Added Printable
1 parent 9e03911 commit 450c4dd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: cores/esp32/MacAddress8.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <MacAddress8.h>
22
#include <stdio.h>
3+
#include <Print.h>
34

45
//Default constructor, blank mac address.
56
MacAddress8::MacAddress8() {
@@ -93,3 +94,15 @@ bool MacAddress8::operator==(const MacAddress8& mac2) const
9394
{
9495
return _mac.val == mac2._mac.val;
9596
}
97+
98+
size_t MacAddress8::printTo(Print& p) const
99+
{
100+
size_t n = 0;
101+
for(int i = 0; i < 8; i++) {
102+
if(i){
103+
n += p.print(':');
104+
}
105+
n += p.printf("%02x", _mac.bytes[i]);
106+
}
107+
return n;
108+
}

0 commit comments

Comments
 (0)