From 89162fcc349d5b98860604fd9c24642537bcc835 Mon Sep 17 00:00:00 2001 From: Yonas Jongkind Date: Thu, 14 Feb 2019 00:14:11 -0800 Subject: [PATCH] Update adding-module.rst Following this tutorial did not work for me, until I made the proposed changes. Then things started to work. --- adding-module.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/adding-module.rst b/adding-module.rst index 0a9dbbe..5aea643 100644 --- a/adding-module.rst +++ b/adding-module.rst @@ -63,7 +63,6 @@ structure. Open the ``mymodule.c`` file and put this code inside: #include "py/obj.h" #include "py/runtime.h" #include "py/binary.h" - #include "portmodules.h" STATIC const mp_map_elem_t mymodule_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_mymodule) }, @@ -126,9 +125,9 @@ actually add that function object to our module: .. code-block:: c - STATIC const mp_map_elem_t mymodule_globals_table[] = { + STATIC const mp_rom_map_elem_t mymodule_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_mymodule) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_hello), (mp_obj_t)&mymodule_hello_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_hello), MP_ROM_PTR(&mymodule_hello_obj) }, }; Micropython uses the QSTR-macros to define constant strings. This is used to