10000 RP2: Add support for Nina-W10 WiFi/BT module. · micropython/micropython@cb8a125 · GitHub
[go: up one dir, main page]

Skip to content

Commit cb8a125

Browse files
committed
RP2: Add support for Nina-W10 WiFi/BT module.
1 parent c784273 commit cb8a125

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

ports/rp2/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,31 @@ if(MICROPY_BLUETOOTH_NIMBLE)
186186
list(APPEND MICROPY_INC_CORE ${NIMBLE_INCLUDE})
187187
endif()
188188

189+
if (MICROPY_PY_NETWORK_NINAW10)
190+
target_compile_definitions(${MICROPY_TARGET} PRIVATE
191+
MICROPY_PY_NETWORK_NINAW10=1
192+
)
193+
194+
target_include_directories(${MICROPY_TARGET} PRIVATE
195+
${MICROPY_DIR}/drivers/ninaw10/
196+
)
197+
198+
# Enable NINA-W10 WiFi and Bluetooth drivers.
199+
list(APPEND MICROPY_SOURCE_DRIVERS
200+
${MICROPY_DIR}/drivers/ninaw10/nina_bt_hci.c
201+
${MICROPY_DIR}/drivers/ninaw10/nina_wifi_drv.c
202+
${MICROPY_DIR}/drivers/ninaw10/nina_wifi_bsp.c
203+
)
204+
205+
list(APPEND MICROPY_SOURCE_EXTMOD
206+
${MICROPY_DIR}/extmod/network_nina.c
207+
)
208+
209+
list(APPEND MICROPY_SOURCE_QSTR
210+
${MICROPY_DIR}/extmod/network_nina.c
211+
)
212+
endif()
213+
189214
# Define mpy-cross flags and frozen manifest
190215
set(MICROPY_CROSS_FLAGS -march=armv7m)
191216
if (NOT MICROPY_FROZEN_MANIFEST)

ports/rp2/mpconfigport.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,20 @@ struct _mp_bluetooth_nimble_malloc_t;
200200
#define MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE
201201
#endif
202202

203+
#if MICROPY_PY_NETWORK_NINAW10
204+
// This Network interface requires the extended socket state.
205+
#ifndef MICROPY_PY_USOCKET_EXTENDED_STATE
206+
#define MICROPY_PY_USOCKET_EXTENDED_STATE (1)
207+
#endif
208+
// It also requires and additional root pointer for the SPI object.
209+
#define MICROPY_PORT_ROOT_POINTER_NINAW10 struct _machine_spi_obj_t *mp_wifi_spi;
210+
extern const struct _mod_network_nic_type_t mod_network_nic_type_nina;
211+
#define MICROPY_HW_NIC_NINAW10 { MP_ROM_QSTR(MP_QSTR_WLAN), MP_ROM_PTR(&mod_network_nic_type_nina) },
212+
#else
213+
#define MICROPY_HW_NIC_NINAW10
214+
#define MICROPY_PORT_ROOT_POINTER_NINAW10
215+
#endif
216+
203217
#define MICROPY_PORT_BUILTIN_MODULES \
204218
{ MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
205219
{ MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&mp_module_onewire }, \
@@ -209,12 +223,13 @@ struct _mp_bluetooth_nimble_malloc_t;
209223
SOCKET_BUILTIN_MODULE \
210224
NETWORK_BUILTIN_MODULE \
211225

226+
#define MICROPY_PORT_NETWORK_INTERFACES \
227+
MICROPY_HW_NIC_NINAW10 \
228+
212229
#ifndef MICROPY_BOARD_ROOT_POINTERS
213230
#define MICROPY_BOARD_ROOT_POINTERS
214231
#endif
215232

216-
#define MICROPY_PORT_NETWORK_INTERFACES \
217-
218233
#define MICROPY_PORT_ROOT_POINTERS \
219234
const char *readline_hist[8]; \
220235
void *machine_pin_irq_obj[30]; \
@@ -224,6 +239,7 @@ struct _mp_bluetooth_nimble_malloc_t;
224239
void *rp2_uart_tx_buffer[2]; \
225240
NETWORK_ROOT_POINTERS \
226241
MICROPY_BOARD_ROOT_POINTERS \
242+
MICROPY_PORT_ROOT_POINTER_NINAW10 \
227243
MICROPY_PORT_ROOT_POINTER_BLUETOOTH \
228244
MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE \
229245

0 commit comments

Comments
 (0)
0