summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-01-22 10:24:30 +1100
committerDamien George <damien.p.george@gmail.com>2017-01-22 11:56:16 +1100
commit739465c04fa674838c63f1c6a30f91a3706179ca (patch)
tree444ac65580d4d1b045af2f90812978a21e47cb6b
parent4d7fba83a6192df95f8728e87d5923b11c29ece6 (diff)
downloadmicropython-739465c04fa674838c63f1c6a30f91a3706179ca.tar.gz
micropython-739465c04fa674838c63f1c6a30f91a3706179ca.zip
teensy: Convert to use builtin help function.
-rw-r--r--teensy/Makefile1
-rw-r--r--teensy/help.c21
-rw-r--r--teensy/mpconfigport.h4
3 files changed, 5 insertions, 21 deletions
diff --git a/teensy/Makefile b/teensy/Makefile
index 5eb8716611..82e04a1ae3 100644
--- a/teensy/Makefile
+++ b/teensy/Makefile
@@ -109,7 +109,6 @@ LIB_SRC_C = $(addprefix lib/,\
libc/string0.c \
mp-readline/readline.c \
utils/pyexec.c \
- utils/pyhelp.c \
)
SRC_TEENSY = $(addprefix core/,\
diff --git a/teensy/help.c b/teensy/help.c
index 147347fc22..3b3916b943 100644
--- a/teensy/help.c
+++ b/teensy/help.c
@@ -24,11 +24,9 @@
* THE SOFTWARE.
*/
-#include <stdio.h>
+#include "py/builtin.h"
-#include "lib/utils/pyhelp.h"
-
-STATIC const char *help_text =
+const char *teensy_help_text =
"Welcome to MicroPython!\n"
"\n"
"For online help please visit http://micropython.org/help/.\n"
@@ -69,18 +67,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/teensy/mpconfigport.h b/teensy/mpconfigport.h
index 334f76d8a0..07f60c43f6 100644
--- a/teensy/mpconfigport.h
+++ b/teensy/mpconfigport.h
@@ -14,6 +14,9 @@
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_OPT_COMPUTED_GOTO (1)
+#define MICROPY_PY_BUILTINS_HELP (1)
+#define MICROPY_PY_BUILTINS_HELP_TEXT teensy_help_text
+
#define MICROPY_PY_IO (0)
#define MICROPY_PY_FROZENSET (1)
#define MICROPY_PY_SYS_EXIT (1)
@@ -28,7 +31,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 }, \
// extra built in modules to add to the list of known ones