diff options
| author | Damien George | 2014-08-26 17:18:12 +0100 |
|---|---|---|
| committer | Damien George | 2014-09-07 20:42:01 +0100 |
| commit | 013d53c0b48cd22ef9476f048c2f944a86d5ce67 (patch) | |
| tree | 753686da1b33b96829df9b2c4d3bd4f9739a9ea7 /stmhal | |
| parent | e2a618615df33d884dde975c3e0a0727d9ea9629 (diff) | |
Remove skeletal modselect from extmod and just put it in stmhal.
Diffstat (limited to 'stmhal')
| -rw-r--r-- | stmhal/modselect.c | 27 | ||||
| -rw-r--r-- | stmhal/mpconfigport.h | 3 | ||||
| -rw-r--r-- | stmhal/portmodules.h | 1 | ||||
| -rw-r--r-- | stmhal/qstrdefsport.h | 7 |
4 files changed, 36 insertions, 2 deletions
diff --git a/stmhal/modselect.c b/stmhal/modselect.c index c7ef3bbec..6594ad218 100644 --- a/stmhal/modselect.c +++ b/stmhal/modselect.c @@ -37,7 +37,9 @@ #include "objlist.h" #include "pybioctl.h" -/// \moduleref select +/// \module select - Provides select function to wait for events on a stream +/// +/// This module provides the select function. typedef struct _poll_obj_t { mp_obj_t obj; @@ -278,3 +280,26 @@ STATIC mp_obj_t select_poll(void) { return poll; } MP_DEFINE_CONST_FUN_OBJ_0(mp_select_poll_obj, select_poll); + +STATIC const mp_map_elem_t mp_module_select_globals_table[] = { + { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_select) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_select), (mp_obj_t)&mp_select_select_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_poll), (mp_obj_t)&mp_select_poll_obj }, +}; + +STATIC const mp_obj_dict_t mp_module_select_globals = { + .base = {&mp_type_dict}, + .map = { + .all_keys_are_qstrs = 1, + .table_is_fixed_array = 1, + .used = MP_ARRAY_SIZE(mp_module_select_globals_table), + .alloc = MP_ARRAY_SIZE(mp_module_select_globals_table), + .table = (mp_map_elem_t*)mp_module_select_globals_table, + }, +}; + +const mp_obj_module_t mp_module_select = { + .base = { &mp_type_module }, + .name = MP_QSTR_select, + .globals = (mp_obj_dict_t*)&mp_module_select_globals, +}; diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index 136560441..bfd399a76 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -57,7 +57,6 @@ #define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_UCTYPES (1) #define MICROPY_PY_ZLIBD (1) -#define MICROPY_PY_SELECT (1) #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) #define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (0) @@ -76,6 +75,7 @@ extern const struct _mp_obj_module_t os_module; extern const struct _mp_obj_module_t pyb_module; extern const struct _mp_obj_module_t stm_module; extern const struct _mp_obj_module_t time_module; +extern const struct _mp_obj_module_t mp_module_select; #if MICROPY_PY_WIZNET5K extern const struct _mp_obj_module_t mp_module_wiznet5k; @@ -89,6 +89,7 @@ extern const struct _mp_obj_module_t mp_module_wiznet5k; { MP_OBJ_NEW_QSTR(MP_QSTR_pyb), (mp_obj_t)&pyb_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_stm), (mp_obj_t)&stm_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_select), (mp_obj_t)&mp_module_select }, \ MICROPY_PY_WIZNET5K_DEF \ // extra constants diff --git a/stmhal/portmodules.h b/stmhal/portmodules.h index 491df6bc4..d71f74e73 100644 --- a/stmhal/portmodules.h +++ b/stmhal/portmodules.h @@ -28,6 +28,7 @@ extern const mp_obj_module_t os_module; extern const mp_obj_module_t pyb_module; extern const mp_obj_module_t stm_module; extern const mp_obj_module_t time_module; +extern const mp_obj_module_t mp_module_select; // additional helper functions exported by the modules diff --git a/stmhal/qstrdefsport.h b/stmhal/qstrdefsport.h index ab5b23f59..7f19d1f09 100644 --- a/stmhal/qstrdefsport.h +++ b/stmhal/qstrdefsport.h @@ -269,6 +269,13 @@ Q(localtime) Q(mktime) Q(sleep) +// for select module +Q(select) +Q(poll) +Q(register) +Q(unregister) +Q(modify) + // for input Q(input) |
