Kernel Interfaces

GPIO (General Purpose Input Output)

  1. root@platform:~# dmesg | grep -i gpio
  2. root@platform:~# ls /sys/class/gpio/
  3. root@platform:~# ls /sys/class/gpio/gpio13
  4. root@platform:~# echo 13 > /sys/class/gpio/export
  5. root@platform:~# ls /sys/class/gpio/gpio13
  6. active_low direction drive edge power subsystem uevent value
  7. root@platform:~# echo in > /sys/class/gpio/gpio13/direction
  8. root@platform:~# echo out > /sys/class/gpio/gpio13/direction
  9. root@platform:~# echo 1 > /sys/class/gpio/gpio13/value
  10. root@platform:~# cat /sys/class/gpio/gpio13/value
  11. root@platform:~# echo 0 > /sys/class/gpio/gpio13/value
  12. root@platform:~# cat /sys/class/gpio/gpio13/value

I2C (Inter-IC)

  1. root@platform:~# dmesg | grep -i i2c
  2. root@platform:~# ls /sys/class/i2c-dev/
  3. i2c-0
  4. root@platform:~# i2cdetect -y -r <Bus>
  5. root@platform:~# i2cdump -f -y <Bus> <0xAddress>