mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
extmod/modnetwork: Use a type protocol to implement NIC functions.
This was previously implemented by adding additional members to the mp_obj_type_t defined for each NIC, which is difficult to do cleanly with the new object type slots mechanism. The way this works is also not supported on GCC 8.x and below. Instead replace it with the type protocol, which is a much simpler way of achieving the same thing. This affects the WizNet (in non-LWIP mode) and Nina NIC drivers. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
committed by
Damien George
parent
7f71057a89
commit
5f8f32f917
@@ -176,18 +176,14 @@ extern const struct _mp_obj_type_t mp_network_cyw43_type;
|
||||
#ifndef MICROPY_PY_USOCKET_EXTENDED_STATE
|
||||
#define MICROPY_PY_USOCKET_EXTENDED_STATE (1)
|
||||
#endif
|
||||
extern const struct _mod_network_nic_type_t mod_network_nic_type_nina;
|
||||
extern const struct _mp_obj_type_t mod_network_nic_type_nina;
|
||||
#define MICROPY_HW_NIC_NINAW10 { MP_ROM_QSTR(MP_QSTR_WLAN), MP_ROM_PTR(&mod_network_nic_type_nina) },
|
||||
#else
|
||||
#define MICROPY_HW_NIC_NINAW10
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_NETWORK_WIZNET5K
|
||||
#if MICROPY_PY_LWIP
|
||||
extern const struct _mp_obj_type_t mod_network_nic_type_wiznet5k;
|
||||
#else
|
||||
extern const struct _mod_network_nic_type_t mod_network_nic_type_wiznet5k;
|
||||
#endif
|
||||
#define MICROPY_HW_NIC_WIZNET5K { MP_ROM_QSTR(MP_QSTR_WIZNET5K), MP_ROM_PTR(&mod_network_nic_type_wiznet5k) },
|
||||
#else
|
||||
#define MICROPY_HW_NIC_WIZNET5K
|
||||
|
||||
Reference in New Issue
Block a user