Skip to content

Commit 8678e3e

Browse files
committed
stmhal: Convert to use builtin help function.
1 parent 9f04dfb commit 8678e3e

3 files changed

Lines changed: 4 additions & 20 deletions

File tree

stmhal/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ SRC_LIB = $(addprefix lib/,\
112112
netutils/netutils.c \
113113
timeutils/timeutils.c \
114114
utils/pyexec.c \
115-
utils/pyhelp.c \
116115
)
117116

118117
SRC_C = \

stmhal/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 *stmhal_help_text =
3230
"Welcome to MicroPython!\n"
3331
"\n"
3432
"For online help please visit http://micropython.org/help/.\n"
@@ -70,17 +68,3 @@ STATIC const char *help_text =
7068
"\n"
7169
"For further help on a specific object, type help(obj)\n"
7270
;
73-
74-
STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) {
75-
if (n_args == 0) {
76-
// print a general help message
77-
printf("%s", help_text);
78-
79-
} else {
80-
// try to print something sensible about the given object
81-
pyhelp_print_obj(args[0]);
82-
}
83-
84-
return mp_const_none;
85-
}
86-
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, pyb_help);

stmhal/mpconfigport.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
#define MICROPY_PY_BUILTINS_FROZENSET (1)
7777
#define MICROPY_PY_BUILTINS_EXECFILE (1)
7878
#define MICROPY_PY_BUILTINS_COMPILE (1)
79+
#define MICROPY_PY_BUILTINS_HELP (1)
80+
#define MICROPY_PY_BUILTINS_HELP_TEXT stmhal_help_text
7981
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
8082
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
8183
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
@@ -130,7 +132,6 @@
130132

131133
// extra built in names to add to the global namespace
132134
#define MICROPY_PORT_BUILTINS \
133-
{ MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
134135
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
135136
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
136137

0 commit comments

Comments
 (0)