summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-06-01 15:32:23 +1000
committerDamien George <damien.p.george@gmail.com>2017-06-01 16:02:49 +1000
commitbc76302eab56368967af4f1cf8813ac816b9c22f (patch)
tree07e7dc94f5d6597b5a3d43b0397f827a627dd595 /py/mpconfig.h
parentb53a63517a71278d0f73f98f4f5ce1b15b14370e (diff)
py/modbuiltins: Add core-provided version of input() function.
The implementation is taken from stmhal/input.c, with code added to handle ctrl-C. This built-in is controlled by MICROPY_PY_BUILTINS_INPUT and is disabled by default. It uses readline() to capture input but this can be overridden by defining the mp_hal_readline macro.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 78e346d73..1ec8ae21c 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -791,6 +791,12 @@ typedef double mp_float_t;
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
#endif
+// Whether to provide the built-in input() function. The implementation of this
+// uses mp-readline, so can only be enabled if the port uses this readline.
+#ifndef MICROPY_PY_BUILTINS_INPUT
+#define MICROPY_PY_BUILTINS_INPUT (0)
+#endif
+
// Whether to support min/max functions
#ifndef MICROPY_PY_BUILTINS_MIN_MAX
#define MICROPY_PY_BUILTINS_MIN_MAX (1)