Skip to content

Commit 8f5bc3f

Browse files
committed
stmhal/moduselect: Move to extmod/ for reuse by other ports.
1 parent c28fed6 commit 8f5bc3f

8 files changed

Lines changed: 16 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
#include "py/mpconfig.h"
28+
#if MICROPY_PY_USELECT
29+
2730
#include <stdio.h>
2831

2932
#include "py/runtime.h"
@@ -309,3 +312,5 @@ const mp_obj_module_t mp_module_uselect = {
309312
.base = { &mp_type_module },
310313
.globals = (mp_obj_dict_t*)&mp_module_select_globals,
311314
};
315+
316+
#endif // MICROPY_PY_WEBSOCKET

py/builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ extern const mp_obj_module_t mp_module_uheapq;
108108
extern const mp_obj_module_t mp_module_uhashlib;
109109
extern const mp_obj_module_t mp_module_ubinascii;
110110
extern const mp_obj_module_t mp_module_urandom;
111+
extern const mp_obj_module_t mp_module_uselect;
111112
extern const mp_obj_module_t mp_module_ussl;
112113
extern const mp_obj_module_t mp_module_machine;
113114
extern const mp_obj_module_t mp_module_lwip;

py/mpconfig.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,11 @@ typedef double mp_float_t;
873873
#define MICROPY_PY_UERRNO (0)
874874
#endif
875875

876+
// Whether to provide "uselect" module (baremetal implementation)
877+
#ifndef MICROPY_PY_USELECT
878+
#define MICROPY_PY_USELECT (0)
879+
#endif
880+
876881
// Whether to provide "utime" module functions implementation
877882
// in terms of mp_hal_* functions.
878883
#ifndef MICROPY_PY_UTIME_MP_HAL

py/objmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
198198
#if MICROPY_PY_URANDOM
199199
{ MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_module_urandom) },
200200
#endif
201+
#if MICROPY_PY_USELECT
202+
{ MP_ROM_QSTR(MP_QSTR_uselect), MP_ROM_PTR(&mp_module_uselect) },
203+
#endif
201204
#if MICROPY_PY_USSL
202205
{ MP_ROM_QSTR(MP_QSTR_ussl), MP_ROM_PTR(&mp_module_ussl) },
203206
#endif

py/py.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ PY_O_BASENAME = \
219219
../extmod/modussl_axtls.o \
220220
../extmod/modussl_mbedtls.o \
221221
../extmod/modurandom.o \
222+
../extmod/moduselect.o \
222223
../extmod/modwebsocket.o \
223224
../extmod/modwebrepl.o \
224225
../extmod/modframebuf.o \

stmhal/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ SRC_C = \
150150
modstm.c \
151151
moduos.c \
152152
modutime.c \
153-
moduselect.c \
154153
modusocket.c \
155154
modnetwork.c \
156155
import.c \

stmhal/mpconfigport.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#define MICROPY_PY_UBINASCII (1)
9393
#define MICROPY_PY_URANDOM (1)
9494
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
95+
#define MICROPY_PY_USELECT (1)
9596
#define MICROPY_PY_UCTYPES (1)
9697
#define MICROPY_PY_UZLIB (1)
9798
#define MICROPY_PY_UJSON (1)
@@ -135,7 +136,6 @@ extern const struct _mp_obj_module_t mp_module_uheapq;
135136
extern const struct _mp_obj_module_t mp_module_uhashlib;
136137
extern const struct _mp_obj_module_t mp_module_uos;
137138
extern const struct _mp_obj_module_t mp_module_utime;
138-
extern const struct _mp_obj_module_t mp_module_uselect;
139139
extern const struct _mp_obj_module_t mp_module_usocket;
140140
extern const struct _mp_obj_module_t mp_module_network;
141141

@@ -159,7 +159,6 @@ extern const struct _mp_obj_module_t mp_module_network;
159159
{ MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \
160160
{ MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_uos }, \
161161
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&mp_module_utime }, \
162-
{ MP_OBJ_NEW_QSTR(MP_QSTR_uselect), (mp_obj_t)&mp_module_uselect }, \
163162
SOCKET_BUILTIN_MODULE \
164163
NETWORK_BUILTIN_MODULE \
165164

stmhal/portmodules.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ extern const mp_obj_module_t pyb_module;
2828
extern const mp_obj_module_t stm_module;
2929
extern const mp_obj_module_t mp_module_uos;
3030
extern const mp_obj_module_t mp_module_utime;
31-
extern const mp_obj_module_t mp_module_uselect;
3231
extern const mp_obj_module_t mp_module_usocket;
3332

3433
// additional helper functions exported by the modules

0 commit comments

Comments
 (0)