Porting Peripherals to AndroidThings - Pin Selection

I am trying to port some code to AndroidThings. It currently uses "GPIO 3 (SCL)" as the pin on the Raspberry Pi. https://github.com/mattdh666/rpi-led-matrix-panel/blob/master/RgbMatrix.h#L206

However, on AndroidThings the same output is "I2C1 (SCL)" so I cannot reference it with peripheralManService.openGpio("BCM3")

see here for a pinout diagram

    try {
        gpioSerialClock = service.openGpio("BCM3"); // Throws Caused by: android.os.ServiceSpecificException: Unknown I/O name BCM3
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }

      

Do I have to move my wire to use a different pin on the Raspberry Pi that is labeled for GPIO? Is there any implication for this: / my peripheral wants to use BCM3 as it is a serial clock

enter image description here

A few more descriptive explanations of the chosen pin:

enter image description here

enter image description here

+3


source to share


1 answer


The code you are carrying assumes that all connected pins are pure GPIO pins. It explicitly manages all contact transitions for each of them. For that matter, you just need 13 available GPIO ports to connect to an RGB matrix. You just need to make the appropriate adjustments to your wiring to match the pin numbers in the example with the ports you selected.



It's not the most efficient way to handle communication with Android Things (lots of round trips and I / O round trips), but should work like a start. Ideally, you will control synchronized serial data from the SPI or I2C bus (if the protocols match) to reduce overhead and improve transfer rates.

+1


source







All Articles