edlins / libPCA9685

superfast PCA9685 library for Debian platforms. developed on Raspbian on a Pi B+.
MIT License
13 stars 8 forks source link

multiple buses/devices #21

Closed edlins closed 5 years ago

edlins commented 6 years ago

LOW priority (not requested, can't test) IDLE status (not a WIP)

Add support for multiple i2c buses. Add support for multiple PCA9685s, on the same or different buses.

I'm just parking this here in case somebody comes along with multiple devices but it's not currently in progress.

pvint commented 6 years ago

I have multiple devices, and at some point I'll look at this. My previous thinking was that I would simply support multiple devices from a higher level making specific calls for each device, but it may prove to be useful to incorporate it into the lib directly.

edlins commented 6 years ago

If you implement something in an app and want it in the lib, I'm happy to look at that after it's done.

pvint commented 6 years ago

I'll keep that in mind - thanks!

BTW: If you're interested in one of my boards which are essentially the same as the Adafruit ones but have outputs >2A each at voltage of your choice (Around 5V to 27V), let me know and I can send one your way. :)

edlins commented 6 years ago

Sure, I'd like to see what you've done. Would give me an excuse to work this issue.

I developed my own drivers that interface with the Adafruit board. They are currently configured to pass up to 700mA@5V off each PWM which maxes out my 9W RGB LEDs. I could do really long runs at 12V but the MOSFETs might get a little hot dropping excess voltage. What I'm thinking about now is jumping the current sense resistor to act as a relay for some 12V solenoid valves and linear actuators I've got around..

deelerke commented 5 years ago

First of all, I REALLY LIKE this code. I'm not an expert in C, and tried some python libs on GitHub first. But man, this one is SO MUCH FASTER!!!

Is there an update or workaround for multiple devices on the same i2c bus ?? I have project with 3 devices on 0x40, 0x41 and 0x42 on a BeagleBone Green

Using quickstart.c example... it works PERFECT .... But, only with one device I tried using your code and replacing fd with fd40, fd41 and fd42 ...and calling all functions 3 times with each fd and device address. Like this

int main(void) { fprintf(stdout, "quickstart \n"); _PCA9685_MODE2 = 0x10; _PCA9685_DEBUG = 1; int adpt = 2; int freq = 40; signal(SIGINT, intHandler); fd40 = initHardware(adpt, 0x40, freq); fd41 = initHardware(adpt, 0x41, freq); fd41 = initHardware(adpt, 0x42, freq);

But that didn't work, only the last called device functions correctly. Multiple device support would be awesome. Are there any plans? I'd send you PCA9685 devices if you need them! Or some workaround you suggest with the current quickstart example .... ? thanks so much!

pvint commented 5 years ago

@deelerke Thanks for contacting me - it got me going and I found a resolution (Pending approval!)

If you have a chance, test it out - see #71

edlins commented 5 years ago

Sorry - I've been away. I'll look into this!

edlins commented 5 years ago

HIGH priority due to multiple requesters.

edlins commented 5 years ago

merged #71