cc3200: Convert to use builtin help function.
This commit is contained in:
parent
4ccd899e65
commit
4d7fba83a6
@ -153,7 +153,6 @@ APP_LIB_SRC_C = $(addprefix lib/,\
|
|||||||
netutils/netutils.c \
|
netutils/netutils.c \
|
||||||
timeutils/timeutils.c \
|
timeutils/timeutils.c \
|
||||||
utils/pyexec.c \
|
utils/pyexec.c \
|
||||||
utils/pyhelp.c \
|
|
||||||
)
|
)
|
||||||
|
|
||||||
APP_STM_SRC_C = $(addprefix stmhal/,\
|
APP_STM_SRC_C = $(addprefix stmhal/,\
|
||||||
|
@ -25,23 +25,8 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "py/builtin.h"
|
||||||
|
|
||||||
#include "lib/utils/pyhelp.h"
|
const char *cc3200_help_text = "Welcome to MicroPython!\n"
|
||||||
|
|
||||||
STATIC const char help_text[] = "Welcome to MicroPython!\n"
|
|
||||||
"For online help please visit http://micropython.org/help/.\n"
|
"For online help please visit http://micropython.org/help/.\n"
|
||||||
"For further help on a specific object, type help(obj)\n";
|
"For further help on a specific object, type help(obj)\n";
|
||||||
|
|
||||||
STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) {
|
|
||||||
if (n_args == 0) {
|
|
||||||
// print a general help message
|
|
||||||
printf("%s", help_text);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// try to print something sensible about the given object
|
|
||||||
pyhelp_print_obj(args[0]);
|
|
||||||
}
|
|
||||||
return mp_const_none;
|
|
||||||
}
|
|
||||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, pyb_help);
|
|
||||||
|
@ -80,6 +80,8 @@
|
|||||||
#define MICROPY_PY_ASYNC_AWAIT (0)
|
#define MICROPY_PY_ASYNC_AWAIT (0)
|
||||||
#define MICROPY_PY_BUILTINS_TIMEOUTERROR (1)
|
#define MICROPY_PY_BUILTINS_TIMEOUTERROR (1)
|
||||||
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
|
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
|
||||||
|
#define MICROPY_PY_BUILTINS_HELP (1)
|
||||||
|
#define MICROPY_PY_BUILTINS_HELP_TEXT cc3200_help_text
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
|
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
|
||||||
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1)
|
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1)
|
||||||
@ -120,7 +122,6 @@
|
|||||||
|
|
||||||
// extra built in names to add to the global namespace
|
// extra built in names to add to the global namespace
|
||||||
#define MICROPY_PORT_BUILTINS \
|
#define MICROPY_PORT_BUILTINS \
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
|
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, \
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, \
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user