summaryrefslogtreecommitdiffstatshomepage
path: root/docs/reference
diff options
context:
space:
mode:
authorPeter Hinch <peter@hinch.me.uk>2016-03-11 10:47:00 +0000
committerDamien George <damien.p.george@gmail.com>2016-03-11 16:32:42 +0000
commit70f32f0f73b703aeeff4a9c9a1c63526ff4fabd8 (patch)
tree712f2f7c3ec0751e19491ad65cac4c095eaebb51 /docs/reference
parent3d0e3a3d3eb3079599de63f2a232b5cf4b26399f (diff)
downloadmicropython-70f32f0f73b703aeeff4a9c9a1c63526ff4fabd8.tar.gz
micropython-70f32f0f73b703aeeff4a9c9a1c63526ff4fabd8.zip
docs: Update asm_thumb2_hints_tips re return type of asm funcs.
Diffstat (limited to 'docs/reference')
-rw-r--r--docs/reference/asm_thumb2_hints_tips.rst22
1 files changed, 17 insertions, 5 deletions
diff --git a/docs/reference/asm_thumb2_hints_tips.rst b/docs/reference/asm_thumb2_hints_tips.rst
index 119bf980ec..f0826e47ef 100644
--- a/docs/reference/asm_thumb2_hints_tips.rst
+++ b/docs/reference/asm_thumb2_hints_tips.rst
@@ -78,11 +78,23 @@ three arguments, which must (if used) be named ``r0``, ``r1`` and ``r2``. When
the code executes the registers will be initialised to those values.
The data types which can be passed in this way are integers and memory
-addresses. With current firmware all possible 32 bit values may be passed.
-Returned integers are restricted in that the top two bits must be identical,
-limiting the range to -2**30 to 2**30 -1. The limitations on number of arguments
-and return values can be overcome by means of the ``array`` module which enables
-any number of values of any type to be accessed.
+addresses. With current firmware all possible 32 bit values may be passed and
+returned. If the return value may have the most significant bit set a Python
+type hint should be employed to enable MicroPython to determine whether the
+value should be interpreted as a signed or unsigned integer: types are
+``int`` or ``uint``.
+
+::
+
+ @micropython.asm_thumb
+ def uadd(r0, r1) -> uint:
+ add(r0, r0, r1)
+
+``hex(uadd(0x40000000,0x40000000))`` will return 0x80000000, demonstrating the
+passing and return of integers where bits 30 and 31 differ.
+
+The limitations on the number of arguments and return values can be overcome by means
+of the ``array`` module which enables any number of values of any type to be accessed.
Multiple arguments
~~~~~~~~~~~~~~~~~~