Commit 4f936afc authored by Damien George's avatar Damien George

stm32/network_wiznet5k: Add ability to set the MAC address.

parent 4410efc1
......@@ -25,6 +25,8 @@
*/
#include <stdio.h>
#include <string.h>
#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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment