2017-05-04 30 views
3

我试图移植一些代码到AndroidThings。目前它使用“GPIO 3(SCL)”作为Raspberry Pi上的引脚。 https://github.com/mattdh666/rpi-led-matrix-panel/blob/master/RgbMatrix.h#L206移植AndroidThings的外设 - 引脚选择

但是在AndroidThings相同的引脚是“I2C1(SCL)”,所以我不能用peripheralManService.openGpio("BCM3") see here for 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); 
    } 

我应该将我的线使用的树莓派另一个引脚被标记引用它为GPIO?是否有任何后果:/我的外设需要使用BCM3,因为它是串行时钟

enter image description here

如果需要选择的引脚的一些更直观的解释:

enter image description here

enter image description here

回答

1

您正在移植的代码假定所有连接的引脚都是纯GPIO引脚。它显式驱动每个引脚的所有引脚转换。在这方面,您只需要13个可用的GPIO端口即可连接到RGB矩阵。您只需对接线进行适当调整即可将示例中的针脚号与您选择的端口相匹配。

这不是处理来自Android Things的通信(大量往返和I/O循环)的最有效方式,但它应该作为一个开始。理想情况下,您可以从SPI或I2C总线驱动时钟串行数据(如果协议匹配),以降低开销并提高传输速率。