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

I need to control the clock and IO data myself
How to independently control SCK and sdio on raspberry pi
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.
There are examples?
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.
I think GPIO for java can't do that. SDIO and SCLK can be control by ndk ?
@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
@nohum thanks ~
and thanks @Fleker
@nohum Can you help me again I also need to read and delay operations using android things gpio
Depending on what you mean with "delay" you could either
- sleep via
SystemClock.sleep(10)(for e.g. 10ms) or - you could register a
GpioCallbackviaPeripheralManager.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.