Raspberry Pi I2C in Ada: Configuration

Development was on a Pi model B, with Raspbian (wheezy) on an 8 GB card.

Starting from the suggestions at Nathan Chantrell's blog (he inspired Ciseco's Slice of PI/O), I installed the package python-smbus, which automatically installed i2c-tools and recommended libi2c-dev, which I installed.

On the Ada side, I installed the packages gnat and gprbuild (which is needed to build a library with mixed Ada and C code). I don't remember whether I installed the build-essentials package first, or whether the other two packages installed the necessary parts anyway.

I edited /etc/modprobe.d/raspi-blacklist.conf to enable I2C in the Broadcom chip - I just commented-out the last line,

   # blacklist spi and i2c by default (many users don't need them)

   blacklist spi-bcm2708
   #blacklist i2c-bcm2708

I added the line i2c-dev to /etc/modules. After a reboot, the device files /dev/i2c-0 and /dev/i2c-1 were present, in group i2c (this group may have been created when i2c-tools was installed).

I added myself to the i2c group, so I don't need to use sudo to run any of the i2c-tools: sudo adduser simon i2c (elsewhere I've seen sudo usermod -a -G i2c simon suggested).

To build, in raspi-i2c-ada/, $ make; then in test/, $ gprbuild.