stm32/network_wiznet5k: Automatically set MAC if device doesn't have one

This commit is contained in:
Damien George 2019-04-05 22:37:06 +11:00
parent 4f936afc44
commit fd523c53c3
1 changed files with 8 additions and 0 deletions

View File

@ -128,6 +128,14 @@ STATIC void wiznet5k_init(void) {
// Seems we need a small delay after init
mp_hal_delay_ms(250);
// If the device doesn't have a MAC address then set one
uint8_t mac[6];
getSHAR(mac);
if ((mac[0] | mac[1] | mac[2] | mac[3] | mac[4] | mac[5]) == 0) {
mp_hal_get_mac(MP_HAL_MAC_ETH0, mac);
setSHAR(mac);
}
// Hook the Wiznet into lwIP
wiznet5k_lwip_init(&wiznet5k_obj);
}