From a34d43b2b7a0651e52eeab52298a02556ed2c23c Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 15 Sep 2021 01:36:39 +1000 Subject: [PATCH] extmod/network_cyw43: Make consistent use of STA and AP constants. The network.STA_IF and network.AP_IF constants are now independent to the CYW43_ITF_STA and CYW43_ITF_AP constants. Signed-off-by: Damien George --- extmod/network_cyw43.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extmod/network_cyw43.c b/extmod/network_cyw43.c index a5ed5d5b8e..d2383c7187 100644 --- a/extmod/network_cyw43.c +++ b/extmod/network_cyw43.c @@ -43,8 +43,8 @@ typedef struct _network_cyw43_obj_t { int itf; } network_cyw43_obj_t; -STATIC const network_cyw43_obj_t network_cyw43_wl0 = { { &mp_network_cyw43_type }, &cyw43_state, 0 }; -STATIC const network_cyw43_obj_t network_cyw43_wl1 = { { &mp_network_cyw43_type }, &cyw43_state, 1 }; +STATIC const network_cyw43_obj_t network_cyw43_wl_sta = { { &mp_network_cyw43_type }, &cyw43_state, CYW43_ITF_STA }; +STATIC const network_cyw43_obj_t network_cyw43_wl_ap = { { &mp_network_cyw43_type }, &cyw43_state, CYW43_ITF_AP }; STATIC void network_cyw43_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { network_cyw43_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -65,7 +65,7 @@ STATIC void network_cyw43_print(const mp_print_t *print, mp_obj_t self_in, mp_pr status_str = "fail"; } mp_printf(print, "", - self->itf == 0 ? "STA" : "AP", + self->itf == CYW43_ITF_STA ? "STA" : "AP", status_str, netif->ip_addr.addr & 0xff, netif->ip_addr.addr >> 8 & 0xff, @@ -76,10 +76,10 @@ STATIC void network_cyw43_print(const mp_print_t *print, mp_obj_t self_in, mp_pr STATIC mp_obj_t network_cyw43_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 0, 1, false); - if (n_args == 0 || mp_obj_get_int(args[0]) == 0) { - return MP_OBJ_FROM_PTR(&network_cyw43_wl0); + if (n_args == 0 || mp_obj_get_int(args[0]) == MOD_NETWORK_STA_IF) { + return MP_OBJ_FROM_PTR(&network_cyw43_wl_sta); } else { - return MP_OBJ_FROM_PTR(&network_cyw43_wl1); + return MP_OBJ_FROM_PTR(&network_cyw43_wl_ap); } }