GithubHelp home page GithubHelp logo

micropython-dev-docs's People

Contributors

deshipu avatar naums avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

micropython-dev-docs's Issues

Compilation error following "Adding a Module" section

In the "Adding a Module" section of your wonderful documentation, the code seems to import a portmodules.h file which doesn't exist within the esp8266 port.

When I attempt to compile I get this error:

mymodule.c:5:25: fatal error: portmodules.h: No such file or directory
 #include "portmodules.h"

If I remove that line it complies just fine.

Use mp_printf instead of printf

on "adding-module":

STATIC void mymodule_hello_print( const mp_print_t *print,
                                  mp_obj_t self_in,
                                  mp_print_kind_t kind ) {
    // get a ptr to the C-struct of the object
    mymodule_hello_obj_t *self = MP_OBJ_TO_PTR(self_in);
    // print the number
    printf ("Hello(%u)", self->hello_number);
}

Should be something like:

STATIC void mymodule_hello_print( const mp_print_t *print,
                                  mp_obj_t self_in,
                                  mp_print_kind_t kind ) {
    // get a ptr to the C-struct of the object
    mymodule_hello_obj_t *self = MP_OBJ_TO_PTR(self_in);
    // print the number
    mp_printf (print, "Hello(%u)", self->hello_number);
}

Adding mymodule.c error

Following the instructions of how to add a module I do get the following error.

CC mymodule.c
mymodule.c:16:5: error: unknown field 'name' specified in initializer
     .name = MP_QSTR_mymodule,
     ^
mymodule.c:16:5: error: initialization makes pointer from integer without a cast [-Werror]
mymodule.c:16:5: error: (near initialization for 'mp_module_mymodule.globals') [-Werror]
cc1: all warnings being treated as errors
../py/mkrules.mk:47: recipe for target 'build/mymodule.o' failed
make: *** [build/mymodule.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.