diff --git a/ports/stm32/network_wiznet5k.c b/ports/stm32/network_wiznet5k.c index 99b8b68536..e0fc5d5bab 100644 --- a/ports/stm32/network_wiznet5k.c +++ b/ports/stm32/network_wiznet5k.c @@ -25,6 +25,8 @@ */ #include +#include + #include "py/runtime.h" #include "py/mphal.h" #include "spi.h" @@ -398,6 +400,16 @@ STATIC mp_obj_t wiznet5k_config(size_t n_args, const mp_obj_t *args, mp_map_t *k if (MP_MAP_SLOT_IS_FILLED(kwargs, i)) { mp_map_elem_t *e = &kwargs->table[i]; switch (mp_obj_str_get_qstr(e->key)) { + case MP_QSTR_mac: { + mp_buffer_info_t buf; + mp_get_buffer_raise(e->value, &buf, MP_BUFFER_READ); + if (buf.len != 6) { + mp_raise_ValueError(NULL); + } + setSHAR(buf.buf); + memcpy(self->netif.hwaddr, buf.buf, 6); + break; + } case MP_QSTR_trace: { self->trace_flags = mp_obj_get_int(e->value); break;