Skip to content
Snippets Groups Projects
Commit 77e0cee4 authored by Damien George's avatar Damien George
Browse files

zephyr: Convert to use builtin help function.

parent 739465c0
Branches
Tags
No related merge requests found
...@@ -44,7 +44,6 @@ SRC_C = main.c \ ...@@ -44,7 +44,6 @@ SRC_C = main.c \
lib/utils/printf.c \ lib/utils/printf.c \
lib/utils/pyexec.c \ lib/utils/pyexec.c \
lib/utils/interrupt_char.c \ lib/utils/interrupt_char.c \
lib/utils/pyhelp.c \
lib/mp-readline/readline.c \ lib/mp-readline/readline.c \
$(SRC_MOD) $(SRC_MOD)
......
...@@ -24,11 +24,9 @@ ...@@ -24,11 +24,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include <stdio.h> #include "py/builtin.h"
#include "lib/utils/pyhelp.h" const char *zephyr_help_text =
STATIC const char *help_text =
"Welcome to MicroPython!\n" "Welcome to MicroPython!\n"
"\n" "\n"
"Control commands:\n" "Control commands:\n"
...@@ -40,17 +38,3 @@ STATIC const char *help_text = ...@@ -40,17 +38,3 @@ STATIC const char *help_text =
"\n" "\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 builtin_help(size_t 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, builtin_help);
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#define MICROPY_PY_BUILTINS_RANGE_ATTRS (0) #define MICROPY_PY_BUILTINS_RANGE_ATTRS (0)
#define MICROPY_PY_BUILTINS_REVERSED (0) #define MICROPY_PY_BUILTINS_REVERSED (0)
#define MICROPY_PY_BUILTINS_SET (0) #define MICROPY_PY_BUILTINS_SET (0)
#define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text
#define MICROPY_PY_ARRAY (0) #define MICROPY_PY_ARRAY (0)
#define MICROPY_PY_COLLECTIONS (0) #define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_CMATH (0) #define MICROPY_PY_CMATH (0)
...@@ -114,5 +116,4 @@ extern const struct _mp_obj_module_t mp_module_time; ...@@ -114,5 +116,4 @@ extern const struct _mp_obj_module_t mp_module_time;
// 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 }, \
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment