Comments (17)
Looks quite straightforward, I'll seee what I can do.
from diozero.
I've made the changes locally, not had time to test it though. Will do so ASAP and commit once done.
from diozero.
Great, thanks for the quick reply!
from diozero.
To be clear I've added this to the pigpio Java wrapper only at this stage. I don't think it will be possible to add this in a device agnostic fashion as it would be extremely difficult to add to all other providers assuming that most if not all of them don't support this.
from diozero.
I think that's reasonable, and works for me.
from diozero.
Finally had a chance to simply check the code compiles which it does. Have committed changes to github, plus updated the compiled library. Note this is currently untested, please let me know of any issues. I will test with an I2C LCD display over the weekend.
from diozero.
Hi,
I'm probably missing something here, but i don't seem to find the implementation. The 'diozero-provider-pigpio' has not been updated with your last commit.
Thanks again
Tiago
from diozero.
Sorry, just realised you have updated the 'pigpioj' project. I'll give it a try.
Thanks!
from diozero.
Yes, I should have said. I've incorporated the equivalent but slightly more useable wrapper methods into the pigpio provider. Will commit the changes today. Let me know of any issues.
from diozero.
Hi,
I've tried it, and i always get the error: PI_BAD_I2C_RLEN. I can see that the write operation works, but then something goes wrong with the reading. The same transaction over the Python wrapper works just fine.
The set of operations, a repeated start transaction, is as follows: [0x04, 0x62, 0x02, 0x07, 0x01, 0x01, 0x02, 0x06, 0x32, 0x03, 0x00].
Still trying to figure it out...
from diozero.
Also there seems to be a small typo/bug on the pigpio C library:
https://github.com/joan2937/pigpio/blob/master/pigpio.c#L10385
It should probably read PI_BAD_I2C_WLEN and not PI_BAD_I2C_RLEN
from diozero.
I wonder if I need to set the ByteOrder... I've checked in a fix for the wrong BAD_I2C constants as well as set the byte order in the pigpio provider class
from diozero.
Thanks, i'll give it a try this evening. Btw, for my implementation i'm using the pigpioj code directly, and not the diozero wrapper.
About the wrong error code. It looks to me like a problem with the actual pigpio C implementation, and not your wrapper. Would you agree?
from diozero.
So, i got it work. The problem was not with the endianness but rather with a small "mismatch" in the expected buffer sizes. Looking at the C implementation in pigpio.c (https://github.com/joan2937/pigpio/blob/master/pigpio.c#L10351) the outBuf must be at least 1 byte larger than the number of bytes you want to read. I think this line should rather read: "if ((bytes + outPos) <= outLen)", otherwise the behaviour is a bit unexpected.
from diozero.
Good work, let me know if I need to make any changes otherwise I'll close this issue.
from diozero.
On pigpioj i wouldn't change anything. On the diozero-provider-pigpio you can remove the line that sets the endianness. Otherwise, keep up the good work, and thanks again!
from diozero.
Done, thanks for testing this out. I'm always happy to receive feedback and suggestions.
from diozero.
Related Issues (20)
- RockPi 4a. Problems with specific gpio pin HOT 1
- WS2811 Led doesn't work on Tinker board R2.0 HOT 1
- WS2811 in tinkerboard HOT 5
- SSDOled won't work for I2C channel HOT 5
- I2C devices are not thread-safe HOT 7
- Using pigpio without root HOT 1
- closing serial port causes close eventloop and shutdown HOT 1
- Enhancement request/offer: SN3218 HOT 1
- Enhancement Request: active braking for PwmMotor HOT 1
- PCA9685 has troubles with certain servo angles HOT 5
- BUG: Updates to board info causing errors/messages HOT 5
- SsdOled "display" methods are confusing
- Add board info support for Raspberry Pi 5 HOT 3
- MockFactory throws warning exceptions when run on non-supported systems (non-critical)
- Emhancement: Make I2C devices "shareable" HOT 1
- Can't close and re-open MFRC522 HOT 3
- Support IRQ triggering for more efficient MFRC22 tag reading HOT 1
- There is a bug in PCA9685 implementation HOT 1
- ServoTrim assumes 180 degree rotation HOT 2
- PCA9685 should have a constructor that takes an I2CDeviceInterface
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diozero.