C/C++ equivalent of Python_GPIO

erenaud
erenaud New Member Posts: 9

Hi

I found on this page (https://wiki.up-community.org/Adafruit) that Adafruit's HAT can be simply used using a sliglty modified version of Python_GPIO.
Is ther any C/C++ equivalent of this ?

Comments

  • Kurt
    Kurt New Member Posts: 146 ✭✭

    I am not sure what you are asking?

    If you are asking if there is any C/C++ way to access the GPIO pins, you might try MRAA.
    https://wiki.up-community.org/MRAA/UPM

    Note: This still requires you to have a kernel installed that supports access to the 40 pin connectors and the like.
    For example I have Ubuntu 16.04 installed with appropriate kernel: https://wiki.up-community.org/Ubuntu

    It has been awhile since I tried using anything that needed it. At the time I installed MRAA from source files instead of the method they show to install. Not sure if still need to or not.

  • erenaud
    erenaud New Member Posts: 9

    Yeah sorry, I realize I wasn't so clear.

    I am aware about MRAA, but it seems a lot of work to get HAT such as ADXL345 or BNO055 working with it.
    What I meant by C/C++ equivalent is something that would allow me to reuse Adafruit or others' library easily.

    Maybe I don't realize how easy it is ? I feel like by using MRAA, I will just have to write a lot more stuff than with Python_GPIO, correct me if I am wrong.

  • Kurt
    Kurt New Member Posts: 146 ✭✭

    Sorry hopefully someone else has other other solutions.

    Again with MRAA you can get/use UPM which has code support for several sensors.

    It has been awhile since I have done much with MRAA, and it was mostly with the Edison boards.

    However I don't know of any c/c++ equivalent. You could probably easily convert the Arduino code to work. I have done that in the past. That is I have my own version of Arduinoish functions, like digitalWrite, pinMode, some simple Stream code... And use that to port other libraries.

    Again hopefully someone else can give you some other solutions.

  • erenaud
    erenaud New Member Posts: 9

    Thanks for your answer, UPM is exactly what I was looking for ! (for anyone passing by : https://upm.mraa.io/)

  • ccalde
    ccalde New Member Posts: 348 ✭✭✭

    Hi @erenaud ,

    Is that discussion closed? If so, please could you redefine the title as [RESOLVED] C/C++ equivalent of Python_GPIO

Privacy Policy