Git Product home page Git Product logo

Comments (17)

mattjlewis avatar mattjlewis commented on May 25, 2024

Looks quite straightforward, I'll seee what I can do.

from diozero.

mattjlewis avatar mattjlewis commented on May 25, 2024

I've made the changes locally, not had time to test it though. Will do so ASAP and commit once done.

from diozero.

tnogueira avatar tnogueira commented on May 25, 2024

Great, thanks for the quick reply!

from diozero.

mattjlewis avatar mattjlewis commented on May 25, 2024

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.

tnogueira avatar tnogueira commented on May 25, 2024

I think that's reasonable, and works for me.

from diozero.

mattjlewis avatar mattjlewis commented on May 25, 2024

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.

tnogueira avatar tnogueira commented on May 25, 2024

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.

tnogueira avatar tnogueira commented on May 25, 2024

Sorry, just realised you have updated the 'pigpioj' project. I'll give it a try.
Thanks!

from diozero.

mattjlewis avatar mattjlewis commented on May 25, 2024

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.

tnogueira avatar tnogueira commented on May 25, 2024

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.

tnogueira avatar tnogueira commented on May 25, 2024

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.

mattjlewis avatar mattjlewis commented on May 25, 2024

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.

tnogueira avatar tnogueira commented on May 25, 2024

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.

tnogueira avatar tnogueira commented on May 25, 2024

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.

mattjlewis avatar mattjlewis commented on May 25, 2024

Good work, let me know if I need to make any changes otherwise I'll close this issue.

from diozero.

tnogueira avatar tnogueira commented on May 25, 2024

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.

mattjlewis avatar mattjlewis commented on May 25, 2024

Done, thanks for testing this out. I'm always happy to receive feedback and suggestions.

from diozero.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.