summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-07-28 18:23:33 -0700
committerScott Shawcroft <scott@tannewt.org>2020-08-19 14:21:59 -0700
commitc5b8401a15b4a34736d0ba86691eb441f65099e2 (patch)
tree771a3be5c2b6e0a9402bb62fd8110df5a0c43764 /shared-bindings
parent837abd6da072a55f3c46d62b013690a12e0ee262 (diff)
First crack at native wifi API
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/wifi/Network.c70
-rw-r--r--shared-bindings/wifi/Network.h40
-rw-r--r--shared-bindings/wifi/Radio.c196
-rw-r--r--shared-bindings/wifi/Radio.h52
-rw-r--r--shared-bindings/wifi/__init__.c71
-rw-r--r--shared-bindings/wifi/__init__.h38
6 files changed, 467 insertions, 0 deletions
diff --git a/shared-bindings/wifi/Network.c b/shared-bindings/wifi/Network.c
new file mode 100644
index 000000000..b4d389dcc
--- /dev/null
+++ b/shared-bindings/wifi/Network.c
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+
+#include "py/objproperty.h"
+#include "py/runtime.h"
+#include "shared-bindings/wifi/Network.h"
+
+//| class Network:
+//| """A wifi network provided by a nearby access point.
+//|
+//| """
+//|
+
+//| def __init__(self) -> None:
+//| """You cannot create an instance of `wifi.Network`. They are returned by `wifi.Radio.start_scanning_networks`."""
+//| ...
+//|
+
+//| ssid: str
+//| """True when the wifi network is enabled."""
+//|
+STATIC mp_obj_t wifi_network_get_ssid(mp_obj_t self) {
+ return common_hal_wifi_network_get_ssid(self);
+
+}
+MP_DEFINE_CONST_FUN_OBJ_1(wifi_network_get_ssid_obj, wifi_network_get_ssid);
+
+const mp_obj_property_t wifi_network_ssid_obj = {
+ .base.type = &mp_type_property,
+ .proxy = { (mp_obj_t)&wifi_network_get_ssid_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj },
+};
+
+STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_ssid), MP_ROM_PTR(&wifi_network_ssid_obj) },
+};
+
+STATIC MP_DEFINE_CONST_DICT(wifi_network_locals_dict, wifi_network_locals_dict_table);
+
+const mp_obj_type_t wifi_network_type = {
+ .base = { &mp_type_type },
+ .name = MP_QSTR_Network,
+ .locals_dict = (mp_obj_t)&wifi_network_locals_dict,
+};
diff --git a/shared-bindings/wifi/Network.h b/shared-bindings/wifi/Network.h
new file mode 100644
index 000000000..8a3d10ca7
--- /dev/null
+++ b/shared-bindings/wifi/Network.h
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_NETWORK_H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_NETWORK_H
+
+#include <stdint.h>
+
+#include "common-hal/wifi/Network.h"
+
+#include "py/objstr.h"
+
+const mp_obj_type_t wifi_network_type;
+
+extern mp_obj_t common_hal_wifi_network_get_ssid(wifi_network_obj_t *self);
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_NETWORK_H
diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c
new file mode 100644
index 000000000..1eb07d8fc
--- /dev/null
+++ b/shared-bindings/wifi/Radio.c
@@ -0,0 +1,196 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <string.h>
+
+#include "py/objproperty.h"
+#include "py/runtime.h"
+#include "shared-bindings/wifi/__init__.h"
+
+//| class Radio:
+//| """Native wifi radio.
+//|
+//| This class manages the station and access point functionality of the native
+//| Wifi radio.
+//|
+//| """
+//|
+
+//| def __init__(self) -> None:
+//| """You cannot create an instance of `wifi.Radio`.
+//| Use `wifi.radio` to access the sole instance available."""
+//| ...
+//|
+
+//| enabled: bool
+//| """True when the wifi radio is enabled."""
+//|
+STATIC mp_obj_t wifi_radio_get_enabled(mp_obj_t self) {
+ return mp_obj_new_bool(common_hal_wifi_radio_get_enabled(self));
+
+}
+MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_enabled_obj, wifi_radio_get_enabled);
+
+const mp_obj_property_t wifi_radio_enabled_obj = {
+ .base.type = &mp_type_property,
+ .proxy = { (mp_obj_t)&wifi_radio_get_enabled_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj },
+};
+
+//| mac_address: Address
+//| """MAC address of the wifi radio. (read-only)"""
+//|
+STATIC mp_obj_t wifi_radio_get_mac_address(mp_obj_t self) {
+ return MP_OBJ_FROM_PTR(common_hal_wifi_radio_get_mac_address(self));
+
+}
+MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_mac_address_obj, wifi_radio_get_mac_address);
+
+const mp_obj_property_t wifi_radio_mac_address_obj = {
+ .base.type = &mp_type_property,
+ .proxy = { (mp_obj_t)&wifi_radio_get_mac_address_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj },
+};
+
+
+//| def start_scanning_networks(self) -> Iterable[Network]:
+//| """"""
+//| ...
+//|
+STATIC mp_obj_t wifi_radio_start_scanning_networks(mp_obj_t self_in) {
+ wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in);
+
+ return common_hal_wifi_radio_start_scanning_networks(self);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_start_scanning_networks_obj, wifi_radio_start_scanning_networks);
+
+//| def stop_scanning_networks(self) -> None:
+//| """Stop scanning for Wifi networks and free any resources used to do it."""
+//| ...
+//|
+STATIC mp_obj_t wifi_radio_stop_scanning_networks(mp_obj_t self_in) {
+ wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in);
+
+ common_hal_wifi_radio_stop_scanning_networks(self);
+
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_scanning_networks_obj, wifi_radio_stop_scanning_networks);
+
+//| def connect(self, ssid: ReadableBuffer, password: ReadableBuffer = b"", *, timeout: Optional[float] = None) -> bool:
+//| """"""
+//| ...
+//|
+STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
+ enum { ARG_ssid, ARG_password, ARG_timeout };
+ static const mp_arg_t allowed_args[] = {
+ { MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
+ { MP_QSTR_password, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
+ { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
+ };
+
+ wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
+ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
+ mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
+
+ mp_float_t timeout = 0;
+ if (args[ARG_timeout].u_obj != mp_const_none) {
+ timeout = mp_obj_get_float(args[ARG_timeout].u_obj);
+ }
+
+
+ mp_buffer_info_t ssid;
+ ssid.len = 0;
+ if (args[ARG_ssid].u_obj != MP_OBJ_NULL) {
+ mp_get_buffer_raise(args[ARG_ssid].u_obj, &ssid, MP_BUFFER_READ);
+ }
+
+ mp_buffer_info_t password;
+ password.len = 0;
+ if (args[ARG_password].u_obj != MP_OBJ_NULL) {
+ mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ);
+ }
+
+ return mp_obj_new_bool(common_hal_wifi_radio_connect(self, ssid.buf, ssid.len, password.buf, password.len, timeout));
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_connect_obj, 1, wifi_radio_connect);
+
+//| ip_address: Optional[ipaddress.IPAddress]
+//| """IP Address of the radio when connected to an access point. None otherwise."""
+//|
+STATIC mp_obj_t wifi_radio_get_ip_address(mp_obj_t self) {
+ return common_hal_wifi_radio_get_ip_address(self);
+
+}
+MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ip_address_obj, wifi_radio_get_ip_address);
+
+const mp_obj_property_t wifi_radio_ip_address_obj = {
+ .base.type = &mp_type_property,
+ .proxy = { (mp_obj_t)&wifi_radio_get_ip_address_obj,
+ (mp_obj_t)&mp_const_none_obj,
+ (mp_obj_t)&mp_const_none_obj },
+};
+
+//| def ping(self, ip) -> int:
+//| """Ping an IP to test connectivity. Returns echo time in milliseconds."""
+//| ...
+//|
+STATIC mp_obj_t wifi_radio_ping(mp_obj_t self_in, mp_obj_t ip_address) {
+ wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in);
+
+ common_hal_wifi_radio_ping(self, ip_address);
+
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(wifi_radio_ping_obj, wifi_radio_ping);
+
+STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_enabled), MP_ROM_PTR(&wifi_radio_enabled_obj) },
+ { MP_ROM_QSTR(MP_QSTR_mac_address), MP_ROM_PTR(&wifi_radio_mac_address_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_start_scanning_networks), MP_ROM_PTR(&wifi_radio_start_scanning_networks_obj) },
+ { MP_ROM_QSTR(MP_QSTR_stop_scanning_networks), MP_ROM_PTR(&wifi_radio_stop_scanning_networks_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&wifi_radio_connect_obj) },
+ // { MP_ROM_QSTR(MP_QSTR_connect_to_enterprise), MP_ROM_PTR(&wifi_radio_connect_to_enterprise_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_ip_address), MP_ROM_PTR(&wifi_radio_ip_address_obj) },
+
+ // { MP_ROM_QSTR(MP_QSTR_access_point_active), MP_ROM_PTR(&wifi_radio_access_point_active_obj) },
+ // { MP_ROM_QSTR(MP_QSTR_start_access_point), MP_ROM_PTR(&wifi_radio_start_access_point_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_ping), MP_ROM_PTR(&wifi_radio_ping_obj) },
+};
+
+STATIC MP_DEFINE_CONST_DICT(wifi_radio_locals_dict, wifi_radio_locals_dict_table);
+
+const mp_obj_type_t wifi_radio_type = {
+ .base = { &mp_type_type },
+ .name = MP_QSTR_Radio,
+ .locals_dict = (mp_obj_t)&wifi_radio_locals_dict,
+};
diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h
new file mode 100644
index 000000000..c3bdac5ba
--- /dev/null
+++ b/shared-bindings/wifi/Radio.h
@@ -0,0 +1,52 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_RADIO_H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_RADIO_H
+
+#include <stdint.h>
+
+#include "common-hal/wifi/Radio.h"
+
+#include "py/objstr.h"
+
+const mp_obj_type_t wifi_radio_type;
+
+extern bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self);
+extern void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled);
+
+extern mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self);
+
+extern mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self);
+extern void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self);
+
+extern bool common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t* ssid, size_t ssid_len, uint8_t* password, size_t password_len, mp_float_t timeout);
+
+extern mp_obj_t common_hal_wifi_radio_get_ip_address(wifi_radio_obj_t *self);
+
+extern mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address);
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_RADIO_H
diff --git a/shared-bindings/wifi/__init__.c b/shared-bindings/wifi/__init__.c
new file mode 100644
index 000000000..a12881094
--- /dev/null
+++ b/shared-bindings/wifi/__init__.c
@@ -0,0 +1,71 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "py/objexcept.h"
+#include "py/runtime.h"
+#include "shared-bindings/wifi/__init__.h"
+#include "shared-bindings/wifi/Network.h"
+#include "shared-bindings/wifi/Radio.h"
+
+//| """
+//| The `wifi` module provides necessary low-level functionality for managing wifi
+//| wifi connections. Use `socketpool` for communicating over the network.
+//|
+//| .. attribute:: radio
+//|
+//| Wifi radio used to manage both station and AP modes.
+//| This object is the sole instance of `wifi.Radio`."""
+//|
+
+
+// Called when wifi is imported.
+STATIC mp_obj_t wifi___init__(void) {
+ common_hal_wifi_init();
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(wifi___init___obj, wifi___init__);
+
+
+STATIC const mp_rom_map_elem_t wifi_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_wifi) },
+ { MP_ROM_QSTR(MP_QSTR_Network), MP_ROM_PTR(&wifi_network_type) },
+ { MP_ROM_QSTR(MP_QSTR_Radio), MP_ROM_PTR(&wifi_radio_type) },
+
+ // Properties
+ { MP_ROM_QSTR(MP_QSTR_radio), MP_ROM_PTR(&common_hal_wifi_radio_obj) },
+
+ // Initialization
+ { MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&wifi___init___obj) },
+
+};
+
+STATIC MP_DEFINE_CONST_DICT(wifi_module_globals, wifi_module_globals_table);
+
+
+const mp_obj_module_t wifi_module = {
+ .base = { &mp_type_module },
+ .globals = (mp_obj_dict_t*)&wifi_module_globals,
+};
diff --git a/shared-bindings/wifi/__init__.h b/shared-bindings/wifi/__init__.h
new file mode 100644
index 000000000..c06ee16be
--- /dev/null
+++ b/shared-bindings/wifi/__init__.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_WIFI___INIT___H
+#define MICROPY_INCLUDED_SHARED_BINDINGS_WIFI___INIT___H
+
+#include "py/objlist.h"
+
+#include "shared-bindings/wifi/Radio.h"
+
+extern wifi_radio_obj_t common_hal_wifi_radio_obj;
+
+void common_hal_wifi_init(void);
+
+#endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI___INIT___H