利用i2c來控制gpio口spa
一、編譯驅動或者安裝驅動code
# opkg update # opkg install kmod-i2c-gpio-custom kmod-i2c-core
# 加載驅動 # insmod i2c-dev # insmod i2c-gpio-custom bus0=0,18,22 # dmesg | grep gpio Mar 23 09:01:23 openwrt kern.info kernel: [ 52.910000] Custom GPIO-based I2C driver version 0.1.1 Mar 23 09:01:23 openwrt kern.info kernel: [ 52.910000] i2c-gpio i2c-gpio.0: using pins 7 (SDA) and 29 (SCL)
二、找到i2c文件blog
驅動安裝完成,成功加載驅動以後,查看是否存在i2c文件,io
文件路徑爲:編譯
/sys/class/i2c-dev/i2c-0