Skip to content

Commit 05e0d72

Browse files
committed
stm32/network: Add USB Network support.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
1 parent 2d754f0 commit 05e0d72

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

ports/stm32/mpconfigport.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ extern const struct _mp_obj_type_t mod_network_nic_type_wiznet5k;
218218
#define MICROPY_HW_NIC_WIZNET5K
219219
#endif
220220

221+
#if MICROPY_HW_NETWORK_USBNET
222+
extern const struct _mp_obj_type_t mod_network_nic_type_usbnet;
223+
#define MICROPY_HW_NIC_USBNET { MP_ROM_QSTR(MP_QSTR_USB_NET), MP_ROM_PTR(&mod_network_nic_type_usbnet) },
224+
#else
225+
#define MICROPY_HW_NIC_USBNET
226+
#endif
227+
221228
// extra constants
222229
#define MICROPY_PORT_CONSTANTS \
223230
MACHINE_BUILTIN_MODULE_CONSTANTS \
@@ -232,6 +239,7 @@ extern const struct _mp_obj_type_t mod_network_nic_type_wiznet5k;
232239
MICROPY_HW_NIC_ETH \
233240
MICROPY_HW_NIC_CYW43 \
234241
MICROPY_HW_NIC_WIZNET5K \
242+
MICROPY_HW_NIC_USBNET \
235243
MICROPY_BOARD_NETWORK_INTERFACES \
236244

237245
#define MP_STATE_PORT MP_STATE_VM

ports/stm32/mpnetworkport.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
#include "lwip/dhcp.h"
4444
#include "lwip/apps/mdns.h"
4545

46+
#if MICROPY_HW_NETWORK_USBNET
47+
#include "extmod/network_usbd_ncm.h"
48+
#endif
49+
4650
#if MICROPY_PY_NETWORK_CYW43
4751
#include "extmod/network_cyw43.h"
4852
#include "lib/cyw43-driver/src/cyw43.h"
@@ -70,6 +74,10 @@ static void pyb_lwip_poll(void) {
7074
wiznet5k_poll();
7175
#endif
7276

77+
#if MICROPY_HW_NETWORK_USBNET
78+
network_usbd_ncm_service_traffic();
79+
#endif
80+
7381
// Run the lwIP internal updates
7482
sys_check_timeouts();
7583

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy