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

I have a device similar to i2c interface, but it is not a standard protocol like i2c. What should I do #116

Open
jmying opened this issue Nov 19, 2018 · 10 comments
Labels

Comments

@jmying
Copy link

jmying commented Nov 19, 2018

t 2g pqeix 1rq7 h roq q

I need to control the clock and IO data myself

@jmying
Copy link
Author

jmying commented Nov 19, 2018

How to independently control SCK and sdio on raspberry pi

@Fleker
Copy link
Contributor

Fleker commented Nov 19, 2018

The best option is to open a bunch of GPIO ports on the Pi and bit-bang on the clock and data lines through software.

@jmying
Copy link
Author

jmying commented Nov 19, 2018

There are examples?

@Fleker
Copy link
Contributor

Fleker commented Nov 20, 2018

I don't think there's an example for Android Things. It'd be tough to have a good example, as you'd have to do it for every specific subformat that exists.

@jmying
Copy link
Author

jmying commented Nov 20, 2018

I think GPIO for java can't do that. SDIO and SCLK can be control by ndk ?

@nohum
Copy link

nohum commented Nov 20, 2018

@jmying The driver for TM1637 displays is bit-banging kind of a I2C protocol over custom GPIOs (using Java), I guess that is exactly what you'll want: https://github.com/androidthings/contrib-drivers/blob/master/tm1637/src/main/java/com/google/android/things/contrib/driver/tm1637/I2cBitBangDevice.java

@jmying
Copy link
Author

jmying commented Nov 20, 2018

@nohum thanks ~

@jmying
Copy link
Author

jmying commented Nov 21, 2018

and thanks @Fleker

@jmying
Copy link
Author

jmying commented Nov 21, 2018

@nohum Can you help me again
I also need to read and delay operations using android things gpio

@nohum
Copy link

nohum commented Nov 21, 2018

Depending on what you mean with "delay" you could either

  • sleep via SystemClock.sleep(10) (for e.g. 10ms) or
  • you could register a GpioCallback via PeripheralManager.getInstance().openGpio() to be notified if your GPIO changes (and then do something with that information).

If you go with option one just pay attention that you do not sleep on the main thread as this will stall the whole app.

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

No branches or pull requests

3 participants