stm32/network_wiznet5k: Add ability to set the MAC address.
This commit is contained in:
parent
4410efc1e3
commit
4f936afc44
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user