Browse Source

stm32/network_wiznet5k: Fix build error with wiznet5k and lwip enabled.

Commit 4dba04a50f refactored the network code
but the combination of MICROPY_PY_WIZNET5K=5500 and MICROPY_PY_LWIP=1
broke.
pull/8132/head
iabdalkader 3 years ago
committed by Damien George
parent
commit
8af9dbbde1
  1. 4
      ports/stm32/mpconfigport.h
  2. 4
      ports/stm32/mpnetworkport.c
  3. 4
      ports/stm32/network_wiznet5k.c

4
ports/stm32/mpconfigport.h

@ -253,7 +253,11 @@ extern const struct _mp_obj_type_t mp_network_cyw43_type;
#endif
#if MICROPY_PY_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

4
ports/stm32/mpnetworkport.c

@ -48,6 +48,10 @@
// Poll lwIP every 128ms
#define LWIP_TICK(tick) (((tick) & ~(SYSTICK_DISPATCH_NUM_SLOTS - 1) & 0x7f) == 0)
#if MICROPY_PY_WIZNET5K
void wiznet5k_poll(void);
#endif
u32_t sys_now(void) {
return mp_hal_ticks_ms();
}

4
ports/stm32/network_wiznet5k.c

@ -269,7 +269,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
mp_hal_pin_obj_t rst = pin_find(args[2]);
// Access the existing object, if it has been constructed with the same hardware interface
if (wiznet5k_obj.base.type == &mod_network_nic_type_wiznet5k) {
if (wiznet5k_obj.base.type == (mp_obj_type_t *)&mod_network_nic_type_wiznet5k) {
if (!(wiznet5k_obj.spi == spi && wiznet5k_obj.cs == cs && wiznet5k_obj.rst == rst
&& wiznet5k_obj.netif.flags != 0)) {
wiznet5k_deinit();
@ -277,7 +277,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size
}
// Init the wiznet5k object
wiznet5k_obj.base.type = &mod_network_nic_type_wiznet5k;
wiznet5k_obj.base.type = (mp_obj_type_t *)&mod_network_nic_type_wiznet5k;
wiznet5k_obj.cris_state = 0;
wiznet5k_obj.spi = spi;
wiznet5k_obj.cs = cs;

Loading…
Cancel
Save