vanvught / rpidmx512

Orange Pi DMX512 / RDM / MIDI / OSC / Art-Net / WS28xx / L6470 / Stepper / TLC59711 / PCA9685 / Servo / PWM / TCNet / SMPTE / RDMNet / LLRP / GD32 / GigaDevice / Raspberry Pi
http://www.orangepi-dmx.org/
MIT License
391 stars 109 forks source link

Raspberry Pi: Library Not Found #234

Closed kenchung285 closed 2 years ago

kenchung285 commented 2 years ago

Excuse me, I'd like to learn how to write I2C with RPI 4 with the files "pca9685.h" and "pca9685.cpp" written by you. But I cannot figure out the following problems :

  1. In rpidmx512/lib-pca9685/pca9685.cpp, you include header files "hal_i2c.h" and "hal_gpio.h". Where can I download these two header files on my RPI 4 ?
  2. I cannot find the function definition of "FUNC_PREFIX()" and "i2c_write()" in line 423, rpidmx512/lib-pca9685/pca9685.cpp

Thank you very much for answering my questions.

vanvught commented 2 years ago

In rpidmx512/lib-pca9685/pca9685.cpp, you include header files "hal_i2c.h" and "hal_gpio.h". Where can I download these two header files on my RPI 4 ?

The include file can be found here https://github.com/vanvught/rpidmx512/tree/master/lib-hal/include And are included in de make file https://github.com/vanvught/rpidmx512/blob/master/lib-pca9685/Makefile.Linux#L4

I cannot find the function definition of "FUNC_PREFIX()" and "i2c_write()" in line 423, rpidmx512/lib-pca9685/pca9685.cpp

The FUNC_PREFIX(x) is defined here https://github.com/vanvught/rpidmx512/blob/master/lib-hal/include/linux/hal_api.h#L30

hippyau commented 2 years ago

Hi @kenchung285, you will find this is not typical Arduino or Linux/RPI compatible code, but specifically for the bare-metal OS Arjan has provided here.

It will need some adaption to work with other platforms I2C libraries.

vanvught commented 2 years ago

you will find this is not typical Arduino or Linux/RPI compatible code, but specifically for the bare-metal OS

Although, the code should work on the Raspberry Pi boards with an OS supported by the bcm2835 library. However, I do not do any test with Raspberry Pi boards. It is much as-is.

kenchung285 commented 2 years ago

Hi @vanvught @hippyau , I see, and thank you for your answers. Actually I've seen someone using the code for RPI and pca9685, so I consider that it's compatible with those RPi with an OS supported by the bcm2835 library.