Skip to content

Commit 4ccd899

Browse files
committed
esp8266: Convert to use builtin help function.
1 parent 8678e3e commit 4ccd899

3 files changed

Lines changed: 4 additions & 20 deletions

File tree

esp8266/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ LIB_SRC_C = $(addprefix lib/,\
128128
netutils/netutils.c \
129129
timeutils/timeutils.c \
130130
utils/pyexec.c \
131-
utils/pyhelp.c \
132131
utils/interrupt_char.c \
133132
)
134133

esp8266/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 *esp_help_text =
3230
"Welcome to MicroPython!\n"
3331
"\n"
3432
"For online docs please visit http://docs.micropython.org/en/latest/esp8266/ .\n"
@@ -54,17 +52,3 @@ STATIC const char *help_text =
5452
"\n"
5553
"For further help on a specific object, type help(obj)\n"
5654
;
57-
58-
STATIC mp_obj_t builtin_help(uint n_args, const mp_obj_t *args) {
59-
if (n_args == 0) {
60-
// print a general help message
61-
printf("%s", help_text);
62-
63-
} else {
64-
// try to print something sensible about the given object
65-
pyhelp_print_obj(args[0]);
66-
}
67-
68-
return mp_const_none;
69-
}
70-
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, builtin_help);

esp8266/mpconfigport.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#define MICROPY_PY_BUILTINS_SLICE (1)
3939
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
4040
#define MICROPY_PY_BUILTINS_PROPERTY (1)
41+
#define MICROPY_PY_BUILTINS_HELP (1)
42+
#define MICROPY_PY_BUILTINS_HELP_TEXT esp_help_text
4143
#define MICROPY_PY___FILE__ (0)
4244
#define MICROPY_PY_GC (1)
4345
#define MICROPY_PY_ARRAY (1)
@@ -140,7 +142,6 @@ void *esp_native_code_commit(void*, size_t);
140142

141143
// extra built in names to add to the global namespace
142144
#define MICROPY_PORT_BUILTINS \
143-
{ MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
144145
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
145146
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
146147

0 commit comments

Comments
 (0)