8000 extmod/network_cyw43: Make consistent use of STA and AP constants. · micropython/micropython@a34d43b · GitHub
[go: up one dir, main page]

Skip to content

Commit a34d43b

Browse files
committed
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>
1 parent 4dba04a commit a34d43b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

extmod/network_cyw43.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ typedef struct _network_cyw43_obj_t {
4343
int itf;
4444
} network_cyw43_obj_t;
4545

46-
STATIC const network_cyw43_obj_t network_cyw43_wl0 = { { &mp_network_cyw43_type }, &cyw43_state, 0 };
47-
STATIC const network_cyw43_obj_t network_cyw43_wl1 = { { &mp_network_cyw43_type }, &cyw43_state, 1 };
46+
STATIC const network_cyw43_obj_t network_cyw43_wl_sta = { { &mp_network_cyw43_type }, &cyw43_state, CYW43_ITF_STA };
47+
STATIC const network_cyw43_obj_t network_cyw43_wl_ap = { { &mp_network_cyw43_type }, &cyw43_state, CYW43_ITF_AP };
4848

4949
STATIC void network_cyw43_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
5050
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
6565
status_str = "fail";
6666
}
6767
mp_printf(print, "<CYW43 %s %s %u.%u.%u.%u>",
68-
self->itf == 0 ? "STA" : "AP",
68+
self->itf == CYW43_ITF_STA ? "STA" : "AP",
6969
status_str,
7070
netif->ip_addr.addr & 0xff,
7171
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
7676

7777
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) {
7878
mp_arg_check_num(n_args, n_kw, 0, 1, false);
79-
if (n_args == 0 || mp_obj_get_int(args[0]) == 0) {
80-
return MP_OBJ_FROM_PTR(&network_cyw43_wl0);
79+
if (n_args == 0 || mp_obj_get_int(args[0]) == MOD_NETWORK_STA_IF) {
80+
return MP_OBJ_FROM_PTR(&network_cyw43_wl_sta);
8181
} else {
82-
return MP_OBJ_FROM_PTR(&network_cyw43_wl1);
82+
return MP_OBJ_FROM_PTR(&network_cyw43_wl_ap);
8383
}
8484
}
8585

0 commit comments

Comments
 (0)
0