Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated Start Condition - How to code? #91

Open
moelski opened this issue Jul 21, 2017 · 4 comments
Open

Repeated Start Condition - How to code? #91

moelski opened this issue Jul 21, 2017 · 4 comments

Comments

@moelski
Copy link

moelski commented Jul 21, 2017

Hi @ALL,

today I tried to implement the AS3935 Lightning Chip in my application. But I run into problems reading the Registers separately.

My first attempt was this:
i2cConnection.Write(0x01); byte res = i2cConnection.ReadByte();
This should read the Byte from Register 0x01. But I alsways get the data from Register 0x00.

My second try was this Code:
var readAction = new I2cReadAction(1); i2cConnection.Execute(new I2cTransaction(new I2cWriteAction(0x01), readAction)); Console.WriteLine($"ergebnis : {readAction.Buffer[0]}");
But this also did not work.

If I read a bulk of data then it works. But that is not a good solution because you have to read to many data at a time.

For me it look like a Problem with the repeated start condition (which is needed for the AS3935 device). I found some notes about changes for the repeated start. But how can I use it?

Any hint would be much appreciated !

regards Dominik

@JTrotta
Copy link

JTrotta commented Sep 25, 2017

Got the same problem with this code:
I2cWriteAction writeAction = new I2cWriteAction(register); I2cReadAction readAction = new I2cReadAction(new byte[byteCount]); I2cTransaction transaction = new I2cTransaction(writeAction, readAction); Execute(transaction); return readAction.Buffer;

@JTrotta
Copy link

JTrotta commented Oct 21, 2017

Have a look to my new libraries. Now repeated start is working

@moelski
Copy link
Author

moelski commented Nov 2, 2017

Hi !
Which libraries did you mean?
I can´t find any new stuff.

SORRY got it.
https://github.com/JTrotta/raspberry-sharp-io

regards Dominik

@JTrotta
Copy link

JTrotta commented Nov 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants