Using LEDs (and other GPIO) from NUTTX SDK



  • My apologies if this is documented somewhere. I couldn't find a clear answer (I'm new to NUTTX also).

    While the Arduino SDK has easy access to the LEDs, i was wondered the preferred access method within NUTTX. I was able to find the GPIO pin numbers in the Arduino SDK and control them manually using the NUTTX GPIO test program. I believe NUTTX abstracts "user LED" as an API but wasn't sure if this is supported by Spresense NUTTX.

    This question leads on to best practice for general GPIO bit banging under NUTTX or is it preferred that all IO wrapped up into device driver.

    Thanks,
    @slipperyseal


  • DeveloperWorld

    Hi

    The best practice is using device drivers. Unfortunately, the current implementation of the userled driver will not work. If you want to use leds you can see how they are used here: https://github.com/sonydevworld/spresense/blob/master/examples/prime/prime_main.c

    Best regards,
    Kamil