Source location for function native.gpioSetValues()

  • Wed 2021.04.07

    Playing with low.js Professional, I've determined I've gone as far as I'm able.

    I'm now in need of the mechanism that will bridge, calling a user defined function that will manipulate the register bits within the Espressif chip itself.

    After careful review of: 'For all functions, see API reference below' from:

    'The native modules are written with the low native API, which consists of:
    low.js specific functions
    parts of the DukTape API'

    . . . there aren't the apparent 'low.js specific' functions listed in either API list.

    Ideally, the project would read and write user programmable pulse generation, both in pulse width, duration and count.

    From the Espressif document, section 15 'RMT (Remote Control) module . . . can be used to generate various types of

    It might be that the 'Signal' module could be extended, or duplicated similarily to meet my goal.

    A very basic demonstartion is needed, and the easiest bit manipulation 'Hello World' equivalent might be with GPIO.

    From the 'Tutorial Blink LED'


    From the 'The API Documentation' we can view the function definition:
    (static) setValues(bits, bitsHiopt)

    and then from that .js module source, locate the call to that function:

    exports.setValues = (bits, bitsHi) => {
    native.gpioSetValues(bits, bitsHi);

    and also determine the binding code block:
    L12 let native = require('native');

    Searching the web site and selecting the sub-menu option:
    Documentation Heading - low.js native API Sub-Heading

    A very simple example can be found on GitHub. . . . . native.cpp holds the code of the native module.

    Links to:

    However, that example uses a demonstration call to DukTape, not what is really needed a tutorial on the 'low.js specific' functions, that of which is how a developer can build custom firmware that manipulates the registers needed to do some actual development with Neonious low.js!

    Please provide the source file or at least enough content of that file to get started to build and compile the function native.gpioSetValues(bits, bitsHi); and native.getValues(callback); within the native.cpp file, and corresponding make file, such that I'm able to learn enough to manipulate register bits.

    With that knowledge, I should be able to create the building blocks of a custom firmware module, that would provide the user interface API documentation similar to 'lowjs_for_esp32/module-gpio.html' to complete a pulse generation module.

    Thank you,

  • Hello Robin,

    I do see the doumentation o the low.js sepciic functions in

    Anyways, for your use case, if I would do it, I would most probably look at the source code of GPIO support of ESP-IDF:
    and try to capsule of the functionality of gpio_set_level into a simple C file. That I would call.


  • Sun 2021.04.11

    After multiple install/compile attempts, and decoding which error goes with which environment, I was able to build and flash the example api native project. Not all of the parts of the tool chain were initially installed.

    re: 'try to capsule of the functionality of gpio_set_level into a simple C file. That I would call.'

    From an attempt using a .c file, I could never resolve this error:

    make: *** No rule to make target `native.cpp', needed by `native.o'.  Stop.

    so, I had no choice but to continue to use the .cpp extension.

    I was successful at creating a file, and was able to sync using lowsync. However, the Graphical IDE now immediately displays the following without the ability to set a breakpoint:

    An fatal error has occured in the program:
    Error: File asks for symbol 'gpio_set_level' which low.js does not know of.
    Program cannot continue.


    it can be seen the Javascript gpio.js module is able to call internally the same function, as that .js file coontains a wrapper function: native.gpioSetValues(bits, bitsHi); which it what my first project is attempting to duplicate.

    #include "gpio.h"
    int native_method_simple_setpin(duk_context *ctx)
    // esp_err_t gpio_set_level(gpio_num_tgpio_num, uint32_t level)
    gpio_num_t gpio_num;
    uint32_t level;
    esp_err_t ret = gpio_set_level( gpio_num, level );
    return ret;
    'This repository neither includes the ESP32 internals nor the neonious IDE. Thus, most development happens outside of the repository.'

    Please point me to the corresponding symbol file needed to notify low.js of my wrapper function, similar to native.gpioSetValues() above. I perused but was unsuccessful, so maybe it is 'outside of the repository'?

    Thank you

  • As written, gpio_set_level is part of ESP-IDF, as written above.

    You seem to have some difficulties with C/C++. I am sorry, I cannot help you there. Not because I do not know what to do, because I just do not have the time for it 😕 It's a steep learning curve... So I wish you good luck.


  • Mon 2021.04.12

    Make created and compiled into .so and .o files without error.

    lowsync correctly sync'ed and uploded those files.

    The Error occurs within the Neonious IDE, reported by that same IDE.


    There doesn't appear to be any documentation detail on errors that are generated by the Neonious tools. While I'll agree there are two examples to follow, the 'Server' one would not access the underlying chip registers, and the 'Add' example only accesses the DukTape 'Add' function bindings. There is not an example to access the internal chip registers as I have stated. I chose a simple task to get started.

    The true issue is lack of suitable tutorials and documentation. Period.

    As I'm sure Neonious intentions are to market their product and hacking kit to promote, build and foster that community, A conciliatory route would be to respond to the question I initially stated. If my understanding is incorrect to that reported error, then an explanation to the process to resolve that specific IDE error is needed.

    Please point me to the corresponding symbol file needed to notify low.js of my wrapper function, similar to native.gpioSetValues() above. I perused but was unsuccessful, so maybe it is 'outside of the repository'?

    Thank you

  • I can only repeat myself.

    gpio_set_level is part of ESP-IDF and you have to take the implementation and copy it into your file. However, this does require knowledge of C/C++ including a basic understanding on what the function is doing, how it is actually interfacing the port through memory. I think the ESP32 version is a bit more complex than simple ARM ones.

    There is no tutorial or documentation about that at low.js because this has nothing to do with low.js.


  • Wed 2021.04.14

    re: 'because this has nothing to do with low.js'

    As shown in the post #5 image the Neonious IDE is reporting to me: 'File asks for symbol 'gpio_set_level' which low.js does not know of' so, low.js is recognizing my wrapper function as it compiled without error and only reports the error on the internal ESP-IDF function name when called by low.js. From the above response, if I'm to accept that I'm informed by the IDE that low.js doesn't know of that function/symbol by name, then what am I supposed to deduce from an error that clearly states that fact when loaded by low.js within the IDE? Your responses are not communicating this obvious conflict. Please help me understand.

    re: 'I think the ESP32 version is a bit more complex'
    re: 'how it is actually interfacing the port through memory'

    Better yet, as L489 within the GPIO.js file is acutally making that call:

    then the Neonious software is already performing that exact task. (last doc desc [2]) As a suggestion, take the file that is allowing L489 to occur, strip out all the other functions internal content leaving just the .h header includes, along with how that class is constructed along with it's constructor etc. if C++, provide simple instructions, such that one function call within that file will compile and generate the same task as the Neonious GPIO module is currently doing. In that way we solve two issues, mine as then I could see and then understand: 'how it is actually interfacing the port through memory' and a suitable tutorial will result that will assist others that wish to extend that which is lacking within the modules listed on the right hand side of [2] above. Simple.

  • Hello Robin,

    of course low.js is performing the task of setting the pins. It does it by calling ESP-IDF. However this interface is currently not exported to be used by modules.

    You can compile any C code, even if functions do not exist. And in these .so files, you can link anything together, even if they do not implement called functions. low.js tries to find whether it can provide the function when loading the module, and if it cannot, it aborts.

    Again, if you implement gpio_set_level, the error will go away. I know this is not an easy task, but it is possible.

    I will not provide more instructions. This is an Open Source project, and I am here to help. But I am doing this for free, so do not expect me to go into detail. Sorry.


Log in to reply