From 8678e3edfd8f56b90d0847ba0a9a6ba615463152 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 21 Jan 2017 23:21:37 +1100 Subject: [PATCH] stmhal: Convert to use builtin help function. --- stmhal/Makefile | 1 - stmhal/help.c | 20 ++------------------ stmhal/mpconfigport.h | 3 ++- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/stmhal/Makefile b/stmhal/Makefile index f39818eb57..3735172dce 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -112,7 +112,6 @@ SRC_LIB = $(addprefix lib/,\ netutils/netutils.c \ timeutils/timeutils.c \ utils/pyexec.c \ - utils/pyhelp.c \ ) SRC_C = \ diff --git a/stmhal/help.c b/stmhal/help.c index 21e81ebc0e..1d4803f750 100644 --- a/stmhal/help.c +++ b/stmhal/help.c @@ -24,11 +24,9 @@ * THE SOFTWARE. */ -#include +#include "py/builtin.h" -#include "lib/utils/pyhelp.h" - -STATIC const char *help_text = +const char *stmhal_help_text = "Welcome to MicroPython!\n" "\n" "For online help please visit http://micropython.org/help/.\n" @@ -70,17 +68,3 @@ STATIC const char *help_text = "\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); diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index c9b5480c8b..100c38e4f6 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -76,6 +76,8 @@ #define MICROPY_PY_BUILTINS_FROZENSET (1) #define MICROPY_PY_BUILTINS_EXECFILE (1) #define MICROPY_PY_BUILTINS_COMPILE (1) +#define MICROPY_PY_BUILTINS_HELP (1) +#define MICROPY_PY_BUILTINS_HELP_TEXT stmhal_help_text #define MICROPY_PY_ALL_SPECIAL_METHODS (1) #define MICROPY_PY_MICROPYTHON_MEM_INFO (1) #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) @@ -130,7 +132,6 @@ // extra built in names to add to the global namespace #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_open), (mp_obj_t)&mp_builtin_open_obj },