Skip to content

Instantly share code, notes, and snippets.

@karantir
Created June 14, 2016 09:49
Show Gist options
  • Save karantir/c3b123a63696a895cc9dad32168fe690 to your computer and use it in GitHub Desktop.
Save karantir/c3b123a63696a895cc9dad32168fe690 to your computer and use it in GitHub Desktop.
Using I2C on OpenWRT

Installing packages.

opkg update
opkg install kmod-i2c-gpio-custom i2c-tools

Loading I2C bus drivers. Using pins 7 (SDA) and 8 (SCL).

insmod i2c-dev
insmod i2c-gpio-custom bus0=0,7,8

Checking.

dmesg | grep i2c

Detecting connected devices.

i2cdetect -y 0

Examining device data.

i2cdump -y 0 0x48

Reading/writing data.

i2cget -y 0 0x48 1
i2cset -y 0 0x48 1 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment