Browse Source

stmhal/moduselect: Move to extmod/ for reuse by other ports.

pull/2633/merge
Paul Sokolovsky 8 years ago
parent
commit
8f5bc3ffc0
  1. 5
      extmod/moduselect.c
  2. 1
      py/builtin.h
  3. 5
      py/mpconfig.h
  4. 3
      py/objmodule.c
  5. 1
      py/py.mk
  6. 1
      stmhal/Makefile
  7. 3
      stmhal/mpconfigport.h
  8. 1
      stmhal/portmodules.h

5
stmhal/moduselect.c → extmod/moduselect.c

@ -24,6 +24,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "py/mpconfig.h"
#if MICROPY_PY_USELECT
#include <stdio.h> #include <stdio.h>
#include "py/runtime.h" #include "py/runtime.h"
@ -309,3 +312,5 @@ const mp_obj_module_t mp_module_uselect = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_select_globals, .globals = (mp_obj_dict_t*)&mp_module_select_globals,
}; };
#endif // MICROPY_PY_WEBSOCKET

1
py/builtin.h

@ -108,6 +108,7 @@ extern const mp_obj_module_t mp_module_uheapq;
extern const mp_obj_module_t mp_module_uhashlib; extern const mp_obj_module_t mp_module_uhashlib;
extern const mp_obj_module_t mp_module_ubinascii; extern const mp_obj_module_t mp_module_ubinascii;
extern const mp_obj_module_t mp_module_urandom; extern const mp_obj_module_t mp_module_urandom;
extern const mp_obj_module_t mp_module_uselect;
extern const mp_obj_module_t mp_module_ussl; extern const mp_obj_module_t mp_module_ussl;
extern const mp_obj_module_t mp_module_machine; extern const mp_obj_module_t mp_module_machine;
extern const mp_obj_module_t mp_module_lwip; extern const mp_obj_module_t mp_module_lwip;

5
py/mpconfig.h

@ -873,6 +873,11 @@ typedef double mp_float_t;
#define MICROPY_PY_UERRNO (0) #define MICROPY_PY_UERRNO (0)
#endif #endif
// Whether to provide "uselect" module (baremetal implementation)
#ifndef MICROPY_PY_USELECT
#define MICROPY_PY_USELECT (0)
#endif
// Whether to provide "utime" module functions implementation // Whether to provide "utime" module functions implementation
// in terms of mp_hal_* functions. // in terms of mp_hal_* functions.
#ifndef MICROPY_PY_UTIME_MP_HAL #ifndef MICROPY_PY_UTIME_MP_HAL

3
py/objmodule.c

@ -198,6 +198,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
#if MICROPY_PY_URANDOM #if MICROPY_PY_URANDOM
{ MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_module_urandom) }, { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_module_urandom) },
#endif #endif
#if MICROPY_PY_USELECT
{ MP_ROM_QSTR(MP_QSTR_uselect), MP_ROM_PTR(&mp_module_uselect) },
#endif
#if MICROPY_PY_USSL #if MICROPY_PY_USSL
{ MP_ROM_QSTR(MP_QSTR_ussl), MP_ROM_PTR(&mp_module_ussl) }, { MP_ROM_QSTR(MP_QSTR_ussl), MP_ROM_PTR(&mp_module_ussl) },
#endif #endif

1
py/py.mk

@ -219,6 +219,7 @@ PY_O_BASENAME = \
../extmod/modussl_axtls.o \ ../extmod/modussl_axtls.o \
../extmod/modussl_mbedtls.o \ ../extmod/modussl_mbedtls.o \
../extmod/modurandom.o \ ../extmod/modurandom.o \
../extmod/moduselect.o \
../extmod/modwebsocket.o \ ../extmod/modwebsocket.o \
../extmod/modwebrepl.o \ ../extmod/modwebrepl.o \
../extmod/modframebuf.o \ ../extmod/modframebuf.o \

1
stmhal/Makefile

@ -150,7 +150,6 @@ SRC_C = \
modstm.c \ modstm.c \
moduos.c \ moduos.c \
modutime.c \ modutime.c \
moduselect.c \
modusocket.c \ modusocket.c \
modnetwork.c \ modnetwork.c \
import.c \ import.c \

3
stmhal/mpconfigport.h

@ -92,6 +92,7 @@
#define MICROPY_PY_UBINASCII (1) #define MICROPY_PY_UBINASCII (1)
#define MICROPY_PY_URANDOM (1) #define MICROPY_PY_URANDOM (1)
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
#define MICROPY_PY_USELECT (1)
#define MICROPY_PY_UCTYPES (1) #define MICROPY_PY_UCTYPES (1)
#define MICROPY_PY_UZLIB (1) #define MICROPY_PY_UZLIB (1)
#define MICROPY_PY_UJSON (1) #define MICROPY_PY_UJSON (1)
@ -135,7 +136,6 @@ extern const struct _mp_obj_module_t mp_module_uheapq;
extern const struct _mp_obj_module_t mp_module_uhashlib; extern const struct _mp_obj_module_t mp_module_uhashlib;
extern const struct _mp_obj_module_t mp_module_uos; extern const struct _mp_obj_module_t mp_module_uos;
extern const struct _mp_obj_module_t mp_module_utime; extern const struct _mp_obj_module_t mp_module_utime;
extern const struct _mp_obj_module_t mp_module_uselect;
extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_usocket;
extern const struct _mp_obj_module_t mp_module_network; extern const struct _mp_obj_module_t mp_module_network;
@ -159,7 +159,6 @@ extern const struct _mp_obj_module_t mp_module_network;
{ MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_uos }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_uos }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&mp_module_utime }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&mp_module_utime }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_uselect), (mp_obj_t)&mp_module_uselect }, \
SOCKET_BUILTIN_MODULE \ SOCKET_BUILTIN_MODULE \
NETWORK_BUILTIN_MODULE \ NETWORK_BUILTIN_MODULE \

1
stmhal/portmodules.h

@ -28,7 +28,6 @@ extern const mp_obj_module_t pyb_module;
extern const mp_obj_module_t stm_module; extern const mp_obj_module_t stm_module;
extern const mp_obj_module_t mp_module_uos; extern const mp_obj_module_t mp_module_uos;
extern const mp_obj_module_t mp_module_utime; extern const mp_obj_module_t mp_module_utime;
extern const mp_obj_module_t mp_module_uselect;
extern const mp_obj_module_t mp_module_usocket; extern const mp_obj_module_t mp_module_usocket;
// additional helper functions exported by the modules // additional helper functions exported by the modules

Loading…
Cancel
Save