Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Add synchronization around I2C #46

Closed
savageautomate opened this issue Aug 9, 2013 · 2 comments
Closed

Add synchronization around I2C #46

savageautomate opened this issue Aug 9, 2013 · 2 comments
Assignees
Milestone

Comments

@savageautomate
Copy link
Member

REF: https://groups.google.com/forum/#!topic/pi4j/CQoVN1eU01Q

FROM: rlsutton1

I have a number of I2C devices attached to my PI (Gyro, ADC + Adafruit PWM), and am polling/writting them at up to 100hz. I found that the I2C bus was failing.

would it be possible to add some synchronization to the pi4j libs around I2C?

In the mean time I added a synchronized wrapper to the I2C Device which solved my problems, thought I'd share the wrapper class here. (see attached).

usage looks like this...

    bus = I2CFactory.getInstance(busNumber);

    // create I2C device instance
    device = new SynchronizedDeviceWrapper(bus.getDevice(address));
@JanJansen47
Copy link

Thank for for this issue. Maybe I have the same nasty problem which occurs add-hoc.
(I'm using custom build i2c based I/O but used the Pi4J classes up to now)

@savageautomate
Copy link
Member Author

Added locks from SynchronizedDeviceWrapper into I2CDeviceImpl.
Available in latest 1.0-SNAPSHOT build

@savageautomate savageautomate added this to the RELEASE 1.0 milestone Feb 15, 2015
@savageautomate savageautomate self-assigned this Feb 15, 2015
mheath pushed a commit to mheath/pi4j that referenced this issue Feb 16, 2021
Pi4J#45 reworked to full junit 5 (removing mixed 4/5 tests)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants