Archived.
In 2012 and 2013, I experimented with programming Raspberry Pi in Scala and integrating with various sensors etc.
I still maintain that it makes sense, at least for programmers, to use their favourite tools (like Scala in my case) even when working with embedded electronics instead of working with underpowered hardware like Arduino using microcontroller-specific languages.
There are some nice ideas for hardware abstractions here.
It became clear, though, that since I am not going to design, sell and work full-time on embedded electronics, it makes more sense to just buy off-the-shelf devices ;)
I want to be able to program my Raspberry Pi in Scala.
That includes:
- working with the i2c bus
- working with GPIO
- sending data to Cosm
I used as sources of information and inspiration:
-
Official Broadcom documentation on BCM2835 peripherals (this is the chip inside Raspberry Pi)
-
Tutorial on RPi Low-Level Peripherals
-
Java i2c binding by Peter Simon epnomis@gmail.com. This was my inspiration to use JNA. Only one call (ioctl) turned out to be neccesary.
-
Adafruit Raspberry Pi Python Code for the parts from Adafruit.
-
Chris Hatton's note on GPIO port on the Raspberry Pi
-
Ilya's note on Unsafe
-
i2c-tools package (the source of python-smbus that Adafruit uses) as an example on how to use i2c-dev driver
-
i2c_bcm2708 driver