summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-09-15 01:36:39 +1000
committerDamien George <damien@micropython.org>2021-09-15 01:37:27 +1000
commita34d43b2b7a0651e52eeab52298a02556ed2c23c (patch)
treee9749868b1d21e7c1a1ad6839f5b13350c4651f5
parent4dba04a50fea01f6f8fec83d64f958f8d14e285a (diff)
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 <damien@micropython.org>
-rw-r--r--extmod/network_cyw43.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/extmod/network_cyw43.c b/extmod/network_cyw43.c
index a5ed5d5b8..d2383c718 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, "<CYW43 %s %s %u.%u.%u.%u>",
- 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);
}
}