Skip to content

Commit 7a0adfe

Browse files
authored
lwIP_Ethernet: rename copied cyw43 mac function (earlephilhower#2604)
Prevent symbol conflicts when including both Wifi.h and cyw43.h Fixes earlephilhower#2602
1 parent db4b167 commit 7a0adfe

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

libraries/lwIP_Ethernet/src/LwipIntfDev.h

+8-12
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@
5353

5454
// Dup'd to avoid CYW43 dependency
5555
// Generate a mac address if one is not set in otp
56-
extern "C" {
57-
static void cyw43_hal_generate_laa_mac(__unused int idx, uint8_t buf[6]) {
58-
pico_unique_board_id_t board_id;
59-
pico_get_unique_board_id(&board_id);
60-
memcpy(buf, &board_id.id[2], 6);
61-
buf[0] &= (uint8_t)~0x1; // unicast
62-
buf[0] |= 0x2; // locally administered
63-
}
64-
};
56+
static void _cyw43_hal_generate_laa_mac(__unused int idx, uint8_t buf[6]) {
57+
pico_unique_board_id_t board_id;
58+
pico_get_unique_board_id(&board_id);
59+
memcpy(buf, &board_id.id[2], 6);
60+
buf[0] &= (uint8_t)~0x1; // unicast
61+
buf[0] |= 0x2; // locally administered
62+
}
6563

6664

6765

@@ -71,8 +69,6 @@ enum EthernetLinkStatus {
7169
LinkOFF
7270
};
7371

74-
extern "C" void cyw43_hal_generate_laa_mac(__unused int idx, uint8_t buf[6]);
75-
7672
template<class RawDev>
7773
class LwipIntfDev: public LwipIntf, public RawDev {
7874
public:
@@ -356,7 +352,7 @@ bool LwipIntfDev<RawDev>::begin(const uint8_t* macAddress, const uint16_t mtu) {
356352
#if 1
357353
// forge a new mac-address from the esp's wifi sta one
358354
// I understand this is cheating with an official mac-address
359-
cyw43_hal_generate_laa_mac(0, _macAddress);
355+
_cyw43_hal_generate_laa_mac(0, _macAddress);
360356
#else
361357
// https://serverfault.com/questions/40712/what-range-of-mac-addresses-can-i-safely-use-for-my-virtual-machines
362358
memset(_macAddress, 0, 6);

0 commit comments

Comments
 (0)