Use to Weather-Board on ubuntu

This is a good example to let you know how to access the I2C bus on the 40-Pin GPIO of ODROID-C1.

Preparations

If you have the Weather Board 2, use the updated guide in this link.
Weather Board 2

How to run

Add to Sensors to the fdt(device tree source)

1. Install one dependency.

sudo apt-get install device-tree-compiler

2. Enable Sensors on device tree.

If you want to use I2C-B, you change I2C address to c11087c0.
I2C-A : c1108500
I2C-B : c11087c0

ex) fdtput -c /media/boot/meson8b_odroidc.dtb /i2c@c11087c0/bmp085@77

sudo -s
fdtput -c /media/boot/meson8b_odroidc.dtb /i2c@c1108500/bmp085@77
fdtput -c /media/boot/meson8b_odroidc.dtb /i2c@c1108500/si702x@40
fdtput -c /media/boot/meson8b_odroidc.dtb /i2c@c1108500/si1132@60

fdtput -t s /media/boot/meson8b_odroidc.dtb /i2c@c1108500/bmp085@77 compatible "bosch,bmp085"
fdtput -t s /media/boot/meson8b_odroidc.dtb /i2c@c1108500/si702x@40 compatible "silab,si702x"
fdtput -t s /media/boot/meson8b_odroidc.dtb /i2c@c1108500/si1132@60 compatible "silab,si1132"

fdtput -t x /media/boot/meson8b_odroidc.dtb /i2c@c1108500/bmp085@77 reg 0x77
fdtput -t x /media/boot/meson8b_odroidc.dtb /i2c@c1108500/si702x@40 reg 0x40
fdtput -t x /media/boot/meson8b_odroidc.dtb /i2c@c1108500/si1132@60 reg 0x60

3. Enable i2c module to autoload on boot.

echo aml_i2c >> /etc/modules

4. Now reboot your board.

Install wiringPi library.

1. Get the wiringPi library compatible ODROID-C1

git clone https://github.com/hardkernel/wiringPi

2. Build the library

cd wiringPi
./build

Compile & Run

gcc -o <create excute file name> <source file name> -lwiringPi -lwiringPiDev -lpthread
sudo ./<created excute file name>

Temperature & Presure Sensors wb_bmp085.c
Temperature & Humidity Sensors wb_si702x.c
Visible & IR & UV sensors wb_1132.c