summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--bare-arm/main.c2
-rw-r--r--py/argcheck.c2
-rw-r--r--py/builtin.c2
-rw-r--r--py/builtinevex.c2
-rw-r--r--py/builtinimport.c2
-rw-r--r--py/nlr.h1
-rw-r--r--py/nlrsetjmp.c1
-rw-r--r--py/obj.c2
-rw-r--r--py/objarray.c2
-rw-r--r--py/objbool.c2
-rw-r--r--py/objboundmeth.c2
-rw-r--r--py/objcell.c2
-rw-r--r--py/objclosure.c2
-rw-r--r--py/objcomplex.c2
-rw-r--r--py/objdict.c2
-rw-r--r--py/objexcept.c2
-rw-r--r--py/objfilter.c2
-rw-r--r--py/objfloat.c2
-rw-r--r--py/objfun.c2
-rw-r--r--py/objgenerator.c2
-rw-r--r--py/objgetitemiter.c2
-rw-r--r--py/objint.c2
-rw-r--r--py/objint_longlong.c2
-rw-r--r--py/objint_mpz.c2
-rw-r--r--py/objlist.c2
-rw-r--r--py/objmap.c2
-rw-r--r--py/objmodule.c2
-rw-r--r--py/objnamedtuple.c2
-rw-r--r--py/objnone.c2
-rw-r--r--py/objobject.c2
-rw-r--r--py/objproperty.c2
-rw-r--r--py/objrange.c2
-rw-r--r--py/objset.c2
-rw-r--r--py/objslice.c2
-rw-r--r--py/objstr.c2
-rw-r--r--py/objstringio.c2
-rw-r--r--py/objtuple.c2
-rw-r--r--py/objtype.c4
-rw-r--r--py/objzip.c2
-rw-r--r--py/opmethods.c2
-rw-r--r--py/runtime.c2
-rw-r--r--py/sequence.c2
-rw-r--r--py/showbc.c2
-rw-r--r--py/stream.c2
-rw-r--r--py/vm.c2
-rw-r--r--qemu-arm/main.c2
-rw-r--r--stmhal/accel.c2
-rw-r--r--stmhal/adc.c2
-rw-r--r--stmhal/boards/PYBV3/mpconfigboard.h2
-rw-r--r--stmhal/cc3k/pybcc3k.c2
-rw-r--r--stmhal/dac.c52
-rw-r--r--stmhal/extint.c2
-rw-r--r--stmhal/gendoc.py2
-rw-r--r--stmhal/help.c2
-rw-r--r--stmhal/i2c.c2
-rw-r--r--stmhal/input.c2
-rw-r--r--stmhal/lcd.c2
-rw-r--r--stmhal/led.c2
-rw-r--r--stmhal/modos.c2
-rw-r--r--stmhal/modstm.c2
-rw-r--r--stmhal/modtime.c2
-rw-r--r--stmhal/pin.c2
-rw-r--r--stmhal/pybwlan.c2
-rw-r--r--stmhal/pyexec.c2
-rw-r--r--stmhal/servo.c2
-rw-r--r--stmhal/spi.c2
-rw-r--r--stmhal/timer.c66
-rw-r--r--stmhal/uart.c2
-rwxr-xr-xtools/build-stm-latest.sh31
-rw-r--r--unix-cpy/main.c2
-rw-r--r--unix/file.c2
-rw-r--r--unix/main.c2
-rw-r--r--unix/modffi.c2
-rw-r--r--unix/modsocket.c2
74 files changed, 204 insertions, 87 deletions
diff --git a/bare-arm/main.c b/bare-arm/main.c
index 8ad9b15870..bdaded4362 100644
--- a/bare-arm/main.c
+++ b/bare-arm/main.c
@@ -2,9 +2,9 @@
#include <stdio.h>
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "lexer.h"
#include "parse.h"
diff --git a/py/argcheck.c b/py/argcheck.c
index bfaa5764f5..4b849d1fe8 100644
--- a/py/argcheck.c
+++ b/py/argcheck.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/builtin.c b/py/builtin.c
index b586792020..5ff40be0c2 100644
--- a/py/builtin.c
+++ b/py/builtin.c
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objstr.h"
diff --git a/py/builtinevex.c b/py/builtinevex.c
index ae82537374..bc3adb6256 100644
--- a/py/builtinevex.c
+++ b/py/builtinevex.c
@@ -1,8 +1,8 @@
#include <stdint.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "lexer.h"
#include "lexerunix.h"
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 07978e61d7..323b63ef61 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -8,9 +8,9 @@
#include <malloc.h>
#endif
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "lexer.h"
#include "lexerunix.h"
diff --git a/py/nlr.h b/py/nlr.h
index c7b5928430..757ae61b2f 100644
--- a/py/nlr.h
+++ b/py/nlr.h
@@ -3,7 +3,6 @@
#include <limits.h>
#include <setjmp.h>
-#include "mpconfig.h"
typedef struct _nlr_buf_t nlr_buf_t;
struct _nlr_buf_t {
diff --git a/py/nlrsetjmp.c b/py/nlrsetjmp.c
index a97c8634b2..a8756d9d87 100644
--- a/py/nlrsetjmp.c
+++ b/py/nlrsetjmp.c
@@ -1,5 +1,6 @@
#include <setjmp.h>
#include <stdio.h>
+#include "mpconfig.h"
#include "nlr.h"
#if MICROPY_NLR_SETJMP
diff --git a/py/obj.c b/py/obj.c
index 4b72514476..e1cee3c234 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -2,9 +2,9 @@
#include <stdarg.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objarray.c b/py/objarray.c
index ea37655762..428e619723 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -1,9 +1,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objbool.c b/py/objbool.c
index 56020914d0..c479fd3629 100644
--- a/py/objbool.c
+++ b/py/objbool.c
@@ -1,8 +1,8 @@
#include <stdlib.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index 55b75e42cd..346118d518 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -1,8 +1,8 @@
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objcell.c b/py/objcell.c
index 7fdf07b046..488a737971 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -1,6 +1,6 @@
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objclosure.c b/py/objclosure.c
index 09371b0348..ca7c537f09 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -1,8 +1,8 @@
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objtuple.h"
diff --git a/py/objcomplex.c b/py/objcomplex.c
index 9244209647..45cff6a184 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "parsenum.h"
diff --git a/py/objdict.c b/py/objdict.c
index 0654a198ea..334798c372 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -2,9 +2,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objtuple.h"
diff --git a/py/objexcept.c b/py/objexcept.c
index 7fd00c11c7..abf56ab036 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -2,9 +2,9 @@
#include <stdarg.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objtuple.h"
diff --git a/py/objfilter.c b/py/objfilter.c
index 3eacdfc9b7..37cb269adc 100644
--- a/py/objfilter.c
+++ b/py/objfilter.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objfloat.c b/py/objfloat.c
index 9249160579..14d861b66f 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -4,9 +4,9 @@
#include <assert.h>
#include <math.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "parsenum.h"
diff --git a/py/objfun.c b/py/objfun.c
index 7a1c3ff15a..e0c25771e1 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -7,9 +7,9 @@
#include <malloc.h>
#endif
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objtuple.h"
diff --git a/py/objgenerator.c b/py/objgenerator.c
index d02f838afe..d7d6dcaaf4 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objgetitemiter.c b/py/objgetitemiter.c
index faa8321c34..15676b452b 100644
--- a/py/objgetitemiter.c
+++ b/py/objgetitemiter.c
@@ -1,8 +1,8 @@
#include <stdlib.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objint.c b/py/objint.c
index 110876e003..bec4e920fd 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -3,9 +3,9 @@
#include <assert.h>
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "parsenum.h"
diff --git a/py/objint_longlong.c b/py/objint_longlong.c
index 7d71c5a691..d319e27463 100644
--- a/py/objint_longlong.c
+++ b/py/objint_longlong.c
@@ -2,9 +2,9 @@
#include <stdint.h>
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "mpz.h"
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index b94dcfee37..bfc7def357 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -3,9 +3,9 @@
#include <stdio.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "parsenumbase.h"
#include "obj.h"
diff --git a/py/objlist.c b/py/objlist.c
index 0c55f524da..d886affff8 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -1,9 +1,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objmap.c b/py/objmap.c
index 45e65549da..c6f8f16572 100644
--- a/py/objmap.c
+++ b/py/objmap.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objmodule.c b/py/objmodule.c
index 15ccd68ac2..d4a45b84a5 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objmodule.h"
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index 4239983589..99a1d7bb9d 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -1,7 +1,7 @@
#include <string.h>
-#include "misc.h"
#include "mpconfig.h"
+#include "misc.h"
#include "nlr.h"
#include "qstr.h"
#include "obj.h"
diff --git a/py/objnone.c b/py/objnone.c
index fc55132f39..49b726bdde 100644
--- a/py/objnone.c
+++ b/py/objnone.c
@@ -1,8 +1,8 @@
#include <stdlib.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objobject.c b/py/objobject.c
index 74a4926b34..62fd0c4c9a 100644
--- a/py/objobject.c
+++ b/py/objobject.c
@@ -1,8 +1,8 @@
#include <stdlib.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objproperty.c b/py/objproperty.c
index dd4eedebdb..220388df0a 100644
--- a/py/objproperty.c
+++ b/py/objproperty.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objrange.c b/py/objrange.c
index 8c0eadd32e..acfeed7d9c 100644
--- a/py/objrange.c
+++ b/py/objrange.c
@@ -1,8 +1,8 @@
#include <stdlib.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objset.c b/py/objset.c
index db3683f608..1d10f94e81 100644
--- a/py/objset.c
+++ b/py/objset.c
@@ -2,9 +2,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objslice.c b/py/objslice.c
index 924927db5f..0488eb4220 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objstr.c b/py/objstr.c
index aab1a4492c..fc7415fe15 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -2,9 +2,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objstringio.c b/py/objstringio.c
index a3a7566300..8b3dfaf61e 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/objtuple.c b/py/objtuple.c
index e6b902d74f..792c65193c 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -1,9 +1,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/objtype.c b/py/objtype.c
index dfaa3ff434..0eb09e5832 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -3,9 +3,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
@@ -189,7 +189,7 @@ STATIC mp_obj_t class_make_new(mp_obj_t self_in, uint n_args, uint n_kw, const m
// now call Python class __init__ function with all args
mp_obj_t init_ret;
if (n_args == 0 && n_kw == 0) {
- init_ret = mp_call_function_n_kw(init_fn[0], 1, 0, (mp_obj_t*)&o);
+ init_ret = mp_call_function_n_kw(init_fn[0], 1, 0, (mp_obj_t*)(void*)&o);
} else {
mp_obj_t *args2 = m_new(mp_obj_t, 1 + n_args + 2 * n_kw);
args2[0] = o;
diff --git a/py/objzip.c b/py/objzip.c
index 4c7070b7c7..c3bffd830d 100644
--- a/py/objzip.c
+++ b/py/objzip.c
@@ -1,8 +1,8 @@
#include <stdlib.h>
#include <assert.h>
-#include "misc.h"
#include "mpconfig.h"
+#include "misc.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/opmethods.c b/py/opmethods.c
index a745ec1227..b029eef7c5 100644
--- a/py/opmethods.c
+++ b/py/opmethods.c
@@ -1,6 +1,6 @@
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/py/runtime.c b/py/runtime.c
index b56740a022..2928de8a72 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -2,9 +2,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objtuple.h"
diff --git a/py/sequence.c b/py/sequence.c
index f91bf43c74..9fce1c51ad 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -2,9 +2,9 @@
#include <stdbool.h>
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime0.h"
diff --git a/py/showbc.c b/py/showbc.c
index e3032e8d98..b5b5ce44aa 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -1,8 +1,8 @@
#include <stdio.h>
#include <assert.h>
-#include "misc.h"
#include "mpconfig.h"
+#include "misc.h"
#include "qstr.h"
#include "bc0.h"
diff --git a/py/stream.c b/py/stream.c
index 72e6ab509d..113eaa46ee 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -1,8 +1,8 @@
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "stream.h"
diff --git a/py/vm.c b/py/vm.c
index d3eb970427..f2ca91be52 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -2,9 +2,9 @@
#include <string.h>
#include <assert.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "emitglue.h"
diff --git a/qemu-arm/main.c b/qemu-arm/main.c
index 6ecc9a4b2e..91c096289e 100644
--- a/qemu-arm/main.c
+++ b/qemu-arm/main.c
@@ -2,9 +2,9 @@
#include <stdio.h>
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "lexer.h"
#include "parse.h"
diff --git a/stmhal/accel.c b/stmhal/accel.c
index d3373f1ebd..64ed8b2f1d 100644
--- a/stmhal/accel.c
+++ b/stmhal/accel.c
@@ -3,9 +3,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/adc.c b/stmhal/adc.c
index 0cc2a9a904..e04571abee 100644
--- a/stmhal/adc.c
+++ b/stmhal/adc.c
@@ -2,9 +2,9 @@
#include <stm32f4xx_hal.h>
#include <string.h>
+#include "mpconfig.h"
#include "misc.h"
#include "nlr.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/boards/PYBV3/mpconfigboard.h b/stmhal/boards/PYBV3/mpconfigboard.h
index 02ad78a64c..af4da0c1d6 100644
--- a/stmhal/boards/PYBV3/mpconfigboard.h
+++ b/stmhal/boards/PYBV3/mpconfigboard.h
@@ -12,7 +12,7 @@
#define MICROPY_HW_ENABLE_RTC (1)
#define MICROPY_HW_ENABLE_TIMER (1)
#define MICROPY_HW_ENABLE_SERVO (1)
-#define MICROPY_HW_ENABLE_DAC (0)
+#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_HW_ENABLE_I2C1 (1)
#define MICROPY_HW_ENABLE_SPI1 (1)
#define MICROPY_HW_ENABLE_SPI3 (0)
diff --git a/stmhal/cc3k/pybcc3k.c b/stmhal/cc3k/pybcc3k.c
index 17b205b949..8712a3780b 100644
--- a/stmhal/cc3k/pybcc3k.c
+++ b/stmhal/cc3k/pybcc3k.c
@@ -2,9 +2,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/dac.c b/stmhal/dac.c
index cd62f017fb..56674c4313 100644
--- a/stmhal/dac.c
+++ b/stmhal/dac.c
@@ -3,9 +3,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "parse.h"
#include "obj.h"
@@ -16,6 +16,31 @@
/// \moduleref pyb
/// \class DAC - digital to analog conversion
///
+/// The DAC is used to output analog values (a specific voltage) on pin X5 or pin X6.
+/// The voltage will be between 0 and 3.3V.
+///
+/// *This module will undergo changes to the API.*
+///
+/// Example usage:
+///
+/// from pyb import DAC
+///
+/// dac = DAC(1) # create DAC 1 on pin X5
+/// dac.write(128) # write a value to the DAC (makes X5 1.65V)
+///
+/// To output a continuous sine-wave:
+///
+/// import math
+/// from pyb import DAC
+///
+/// # create a buffer containing a sine-wave
+/// buf = bytearray(100)
+/// for i in range(len(buf)):
+/// buf[i] = 128 + 127 * math.sin(2 * math.pi * i / len(buf))
+///
+/// # output the sine-wave at 400Hz
+/// dac = DAC(1)
+/// dac.write_timed(buf, 400 * len(buf), mode=DAC.CIRCULAR)
STATIC DAC_HandleTypeDef DAC_Handle;
@@ -52,6 +77,10 @@ typedef struct _pyb_dac_obj_t {
// create the dac object
// currently support either DAC1 on X5 (id = 1) or DAC2 on X6 (id = 2)
+/// \classmethod \constructor(id)
+/// Construct a new DAC object.
+///
+/// `id` can be 1 or 2: DAC 1 is on pin X5 and DAC 2 is on pin X6.
STATIC mp_obj_t pyb_dac_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, 1, false);
@@ -93,6 +122,9 @@ STATIC mp_obj_t pyb_dac_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
return dac;
}
+/// \method noise(freq)
+/// Generate a pseudo-random noise signal. A new random sample is written
+/// to the DAC output at the given frequency.
STATIC mp_obj_t pyb_dac_noise(mp_obj_t self_in, mp_obj_t freq) {
pyb_dac_obj_t *self = self_in;
@@ -117,6 +149,10 @@ STATIC mp_obj_t pyb_dac_noise(mp_obj_t self_in, mp_obj_t freq) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_noise_obj, pyb_dac_noise);
+/// \method triangle(freq)
+/// Generate a triangle wave. The value on the DAC output changes at
+/// the given frequency, and the frequence of the repeating triangle wave
+/// itself is 256 (or 1024, need to check) times smaller.
STATIC mp_obj_t pyb_dac_triangle(mp_obj_t self_in, mp_obj_t freq) {
pyb_dac_obj_t *self = self_in;
@@ -141,7 +177,8 @@ STATIC mp_obj_t pyb_dac_triangle(mp_obj_t self_in, mp_obj_t freq) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_triangle_obj, pyb_dac_triangle);
-// direct access to DAC (8 bit only at the moment)
+/// \method write(value)
+/// Direct access to the DAC output (8 bit only at the moment).
STATIC mp_obj_t pyb_dac_write(mp_obj_t self_in, mp_obj_t val) {
pyb_dac_obj_t *self = self_in;
@@ -160,12 +197,15 @@ STATIC mp_obj_t pyb_dac_write(mp_obj_t self_in, mp_obj_t val) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_dac_write_obj, pyb_dac_write);
-// initiates a burst of RAM->DAC using DMA
-// input data is treated as an array of bytes (8 bit data)
-// TIM6 is used to set the frequency of the transfer
+/// \method write_timed(data, freq, *, mode=DAC.NORMAL)
+/// Initiates a burst of RAM to DAC using a DMA transfer.
+/// The input data is treated as an array of bytes (8 bit data).
+///
+/// `mode` can be `DAC.NORMAL` or `DAC.CIRCULAR`.
+///
+/// TIM6 is used to control the frequency of the transfer.
// TODO add callback argument, to call when transfer is finished
// TODO add double buffer argument
-
STATIC const mp_arg_t pyb_dac_write_timed_args[] = {
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_freq, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
diff --git a/stmhal/extint.c b/stmhal/extint.c
index 61469e0a17..90016d19a9 100644
--- a/stmhal/extint.c
+++ b/stmhal/extint.c
@@ -4,9 +4,9 @@
#include <stm32f4xx_hal.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "gc.h"
#include "obj.h"
diff --git a/stmhal/gendoc.py b/stmhal/gendoc.py
index 42882ad277..e52ca5d8aa 100644
--- a/stmhal/gendoc.py
+++ b/stmhal/gendoc.py
@@ -343,7 +343,7 @@ def main():
args = cmd_parser.parse_args()
if len(args.files) == 0:
- args.files = ['modpyb.c', 'accel.c', 'adc.c', 'dac.c', 'extint.c', 'i2c.c', 'led.c', 'pin.c', 'rng.c', 'servo.c', 'spi.c', 'uart.c', 'usrsw.c']
+ args.files = ['modpyb.c', 'accel.c', 'adc.c', 'dac.c', 'extint.c', 'i2c.c', 'led.c', 'pin.c', 'rng.c', 'servo.c', 'spi.c', 'uart.c', 'usrsw.c', 'timer.c']
doc = Doc()
for file in args.files:
diff --git a/stmhal/help.c b/stmhal/help.c
index 975a102445..084d708e6e 100644
--- a/stmhal/help.c
+++ b/stmhal/help.c
@@ -1,8 +1,8 @@
#include <stdio.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
diff --git a/stmhal/i2c.c b/stmhal/i2c.c
index ef9da496d0..b8de855304 100644
--- a/stmhal/i2c.c
+++ b/stmhal/i2c.c
@@ -3,9 +3,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/input.c b/stmhal/input.c
index 0ded898667..a45a36198c 100644
--- a/stmhal/input.c
+++ b/stmhal/input.c
@@ -1,6 +1,6 @@
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "readline.h"
diff --git a/stmhal/lcd.c b/stmhal/lcd.c
index efee13d233..f121a93d7a 100644
--- a/stmhal/lcd.c
+++ b/stmhal/lcd.c
@@ -2,9 +2,9 @@
#include <string.h>
#include <stm32f4xx_hal.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#if MICROPY_HW_HAS_LCD
diff --git a/stmhal/led.c b/stmhal/led.c
index 9e32c52483..264a475484 100644
--- a/stmhal/led.c
+++ b/stmhal/led.c
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <stm32f4xx_hal.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/modos.c b/stmhal/modos.c
index 33b4ff73e0..076a28782e 100644
--- a/stmhal/modos.c
+++ b/stmhal/modos.c
@@ -1,8 +1,8 @@
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "systick.h"
diff --git a/stmhal/modstm.c b/stmhal/modstm.c
index 078f590ece..a2b72995ae 100644
--- a/stmhal/modstm.c
+++ b/stmhal/modstm.c
@@ -3,9 +3,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "modstm.h"
diff --git a/stmhal/modtime.c b/stmhal/modtime.c
index 83be2deaa1..410c6391e2 100644
--- a/stmhal/modtime.c
+++ b/stmhal/modtime.c
@@ -1,8 +1,8 @@
#include <stm32f4xx_hal.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "modtime.h"
diff --git a/stmhal/pin.c b/stmhal/pin.c
index 608f225dae..5b0f998de6 100644
--- a/stmhal/pin.c
+++ b/stmhal/pin.c
@@ -4,9 +4,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/pybwlan.c b/stmhal/pybwlan.c
index 72cb9bfd98..06309b61c0 100644
--- a/stmhal/pybwlan.c
+++ b/stmhal/pybwlan.c
@@ -5,9 +5,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/pyexec.c b/stmhal/pyexec.c
index 3f9482ec58..6a8929cb4e 100644
--- a/stmhal/pyexec.c
+++ b/stmhal/pyexec.c
@@ -3,9 +3,9 @@
#include <stm32f4xx_hal.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "misc.h"
#include "lexer.h"
diff --git a/stmhal/servo.c b/stmhal/servo.c
index 2ebe64376f..68e211bcb3 100644
--- a/stmhal/servo.c
+++ b/stmhal/servo.c
@@ -2,9 +2,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/spi.c b/stmhal/spi.c
index ba550f9799..c1b8e75d05 100644
--- a/stmhal/spi.c
+++ b/stmhal/spi.c
@@ -3,9 +3,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/stmhal/timer.c b/stmhal/timer.c
index 1578e9b1d9..e1d55e14a0 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.c
@@ -16,6 +16,38 @@
#include "timer.h"
#include "servo.h"
+/// \moduleref pyb
+/// \class Timer - periodically call a function
+///
+/// Timers can be used for a great variety of tasks. At the moment, only
+/// the simplest case is implemented: that of calling a function periodically.
+///
+/// Each timer consists of a counter that counts up at a certain rate. The rate
+/// at which it counts is the peripheral clock frequency (in Hz) divided by the
+/// timer prescaler. When the counter reaches the timer period it triggers an
+/// event, and the counter resets back to zero. By using the callback method,
+/// the timer event can call a Python function.
+///
+/// Example usage to toggle an LED at a fixed frequency:
+///
+/// tim = pyb.Timer(4) # create a timer object using timer 4
+/// tim.init(freq=2) # trigger at 2Hz
+/// tim.callback(lambda t:pyb.LED(1).toggle())
+///
+/// Further examples:
+///
+/// tim = pyb.Timer(4, freq=100) # freq in Hz
+/// tim = pyb.Timer(4, prescaler=1, period=100)
+/// tim.counter() # get counter (can also set)
+/// tim.prescaler(2) # set prescaler (can also get)
+/// tim.period(200) # set period (can also get)
+/// tim.callback(lambda t: ...) # set callback for update interrupt (t=tim instance)
+/// tim.callback(None) # clear callback
+///
+/// *Note:* Timer 3 is reserved for internal use. Timer 5 controls
+/// the servo driver, and Timer 6 is used for timed ADC/DAC reading/writing.
+/// It is recommended to use the other timers in your programs.
+
// The timers can be used by multiple drivers, and need a common point for
// the interrupts to be dispatched, so they are all collected here.
//
@@ -29,16 +61,6 @@
//
// TIM6:
// - ADC, DAC for read_timed and write_timed
-//
-// Python usage model:
-//
-// tim = pyb.Timer(4, freq=100) # freq in Hz
-// tim = pyb.Timer(4, prescaler=1, period=100)
-// tim.counter() # get counter (can also set)
-// tim.prescaler(2) # set prescaler (can also get)
-// tim.period(200) # set period (can also get)
-// tim.callback(lambda t: ...) # set callback for update interrupt (t=tim instance)
-// tim.callback(None) # clear callback
typedef struct _pyb_timer_obj_t {
mp_obj_base_t base;
@@ -173,6 +195,12 @@ STATIC void pyb_timer_print(void (*print)(void *env, const char *fmt, ...), void
}
}
+/// \method init(*, freq, prescaler, period)
+/// Initialise the timer. Initialisation must be either by frequency (in Hz)
+/// or by prescaler and period:
+///
+/// tim.init(freq=100) # set the timer to trigger at 100Hz
+/// tim.init(prescaler=100, period=300) # set the prescaler and period directly
STATIC const mp_arg_t pyb_timer_init_args[] = {
{ MP_QSTR_freq, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0xffffffff} },
{ MP_QSTR_prescaler, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0xffffffff} },
@@ -257,6 +285,10 @@ STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, uint n_args, const
return mp_const_none;
}
+/// \classmethod \constructor(id, ...)
+/// Construct a new timer object of the given id. If additional
+/// arguments are given, then the timer is initialised by `init(...)`.
+/// `id` can be 1 to 14, excluding 3.
STATIC mp_obj_t pyb_timer_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
@@ -308,6 +340,10 @@ STATIC mp_obj_t pyb_timer_init(uint n_args, const mp_obj_t *args, mp_map_t *kw_a
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_init_obj, 1, pyb_timer_init);
+/// \method deinit()
+/// Deinitialises the timer.
+///
+/// *This function is not yet implemented.*
STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
//pyb_timer_obj_t *self = self_in;
// TODO implement me
@@ -315,6 +351,8 @@ STATIC mp_obj_t pyb_timer_deinit(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_timer_deinit_obj, pyb_timer_deinit);
+/// \method counter([value])
+/// Get or set the timer counter.
mp_obj_t pyb_timer_counter(uint n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = args[0];
if (n_args == 1) {
@@ -328,6 +366,8 @@ mp_obj_t pyb_timer_counter(uint n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_counter_obj, 1, 2, pyb_timer_counter);
+/// \method prescaler([value])
+/// Get or set the prescaler for the timer.
mp_obj_t pyb_timer_prescaler(uint n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = args[0];
if (n_args == 1) {
@@ -341,6 +381,8 @@ mp_obj_t pyb_timer_prescaler(uint n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_prescaler_obj, 1, 2, pyb_timer_prescaler);
+/// \method period([value])
+/// Get or set the period of the timer.
mp_obj_t pyb_timer_period(uint n_args, const mp_obj_t *args) {
pyb_timer_obj_t *self = args[0];
if (n_args == 1) {
@@ -354,6 +396,10 @@ mp_obj_t pyb_timer_period(uint n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_timer_period_obj, 1, 2, pyb_timer_period);
+/// \method callback(fun)
+/// Set the function to be called when the timer triggers.
+/// `fun` is passed 1 argument, the timer object.
+/// If `fun` is `None` then the callback will be disabled.
STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
pyb_timer_obj_t *self = self_in;
if (callback == mp_const_none) {
diff --git a/stmhal/uart.c b/stmhal/uart.c
index 6dc60ca084..04373a8840 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -3,9 +3,9 @@
#include "stm32f4xx_hal.h"
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/tools/build-stm-latest.sh b/tools/build-stm-latest.sh
new file mode 100755
index 0000000000..951d8be9c2
--- /dev/null
+++ b/tools/build-stm-latest.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# check/get parameters
+if [ $# != 1 ]; then
+ echo "usage: $0 <dest-dir>"
+ exit 1
+fi
+
+dest_dir=$1
+
+# check we are in the correct directory
+if [ ! -r modpyb.c ]; then
+ echo "must be in stm directory"
+ exit 1
+fi
+
+# get the date
+date=$(date '+%Y-%m-%d')
+
+# get the git hash
+git_hash="$(git rev-parse --short HEAD 2> /dev/null || echo unknown)"
+
+# build the versions
+for board in PYBV3 PYBV10; do
+ echo $board
+ lower_board=$(echo $board | tr A-Z a-z)
+ build_dir=/tmp/stm-build-$lower_board
+ make -B BOARD=$board BUILD=$build_dir || exit 1
+ mv $build_dir/flash.dfu $dest_dir/$lower_board-$date-$git_hash.dfu
+ rm -rf $build_dir
+done
diff --git a/unix-cpy/main.c b/unix-cpy/main.c
index 6cdd72c5da..3f42398f59 100644
--- a/unix-cpy/main.c
+++ b/unix-cpy/main.c
@@ -3,9 +3,9 @@
#include <stdio.h>
#include <string.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "lexer.h"
#include "lexerunix.h"
diff --git a/unix/file.c b/unix/file.c
index 041e28e956..04305cac7a 100644
--- a/unix/file.c
+++ b/unix/file.c
@@ -5,9 +5,9 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/unix/main.c b/unix/main.c
index 4c86edeae5..e677ff65d0 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -8,9 +8,9 @@
#include <sys/types.h>
#include <errno.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "lexer.h"
#include "lexerunix.h"
diff --git a/unix/modffi.c b/unix/modffi.c
index be542625ed..39551c264f 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -4,9 +4,9 @@
#include <dlfcn.h>
#include <ffi.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "runtime.h"
diff --git a/unix/modsocket.c b/unix/modsocket.c
index e52f5d92a9..898d5bfe9f 100644
--- a/unix/modsocket.c
+++ b/unix/modsocket.c
@@ -11,9 +11,9 @@
#include <netdb.h>
#include <errno.h>
+#include "mpconfig.h"
#include "nlr.h"
#include "misc.h"
-#include "mpconfig.h"
#include "qstr.h"
#include "obj.h"
#include "objtuple.h"