Skip to content

Commit 77e0cee

Browse files
committed
zephyr: Convert to use builtin help function.
1 parent 739465c commit 77e0cee

3 files changed

Lines changed: 4 additions & 20 deletions

File tree

zephyr/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ SRC_C = main.c \
4444
lib/utils/printf.c \
4545
lib/utils/pyexec.c \
4646
lib/utils/interrupt_char.c \
47-
lib/utils/pyhelp.c \
4847
lib/mp-readline/readline.c \
4948
$(SRC_MOD)
5049

zephyr/help.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
#include <stdio.h>
27+
#include "py/builtin.h"
2828

29-
#include "lib/utils/pyhelp.h"
30-
31-
STATIC const char *help_text =
29+
const char *zephyr_help_text =
3230
"Welcome to MicroPython!\n"
3331
"\n"
3432
"Control commands:\n"
@@ -40,17 +38,3 @@ STATIC const char *help_text =
4038
"\n"
4139
"For further help on a specific object, type help(obj)\n"
4240
;
43-
44-
STATIC mp_obj_t builtin_help(size_t n_args, const mp_obj_t *args) {
45-
if (n_args == 0) {
46-
// print a general help message
47-
printf("%s", help_text);
48-
49-
} else {
50-
// try to print something sensible about the given object
51-
pyhelp_print_obj(args[0]);
52-
}
53-
54-
return mp_const_none;
55-
}
56-
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, builtin_help);

zephyr/mpconfigport.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
#define MICROPY_PY_BUILTINS_RANGE_ATTRS (0)
4949
#define MICROPY_PY_BUILTINS_REVERSED (0)
5050
#define MICROPY_PY_BUILTINS_SET (0)
51+
#define MICROPY_PY_BUILTINS_HELP (1)
52+
#define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text
5153
#define MICROPY_PY_ARRAY (0)
5254
#define MICROPY_PY_COLLECTIONS (0)
5355
#define MICROPY_PY_CMATH (0)
@@ -114,5 +116,4 @@ extern const struct _mp_obj_module_t mp_module_time;
114116

115117
// extra built in names to add to the global namespace
116118
#define MICROPY_PORT_BUILTINS \
117-
{ MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
118119

0 commit comments

Comments
 (0)