Planned Support

Extensions


The core code for Orangutan-lib has almost no cross-dependencies. The only one that exists is that every subsystem includes device.h where all of the Orangutan-specific information is stored. When it came time to write code that depended on more than one subsystem, or that built on an existing subsystem, rather than run the risk of having multiple cross-dependencies between subsystems, we chose to stick these in another category: Extensions.

The extensions represent a lot of hardware-specific examples, like the QTI sensors, or examples of devices that rely on I2C or SPI communication in order to work, like the SRF08 ultrasound or the MCP4822 DAC. In addition to offering examples for how to build on what's in the basic library, they are also fully-functional pieces of code for interfacing to specific devices.


lcd-bargraph.h / lcd-bargraph.c


lcd-bargraph uses a single character on the Orangutan or Orangutan-X2 LCD to display a vertical bargraph. Not much in terms of resolution, but it lets you display a number of 8-bit values without taking up too much real-estate on the LCD.

lcd_bar_init()

The LCD bargraph does its thing by creating eight custom characters that are stored in the HD447780 controller chip on the LCD. For that to happen, lcd_bar_init() needs to be called before the bargraph function is used.

lcd_bar(data)

lcd_bar() takes an 8-bit value. A bargraph representing the value (mo bar for a value of 0, full bar for a value of 255, intermediate bar for values in-between) will be displayed at the current character position on the LCD.


qti.h / qti.c


The Parallax QTI sensors are a little strange to read. They're not simple analog devices. In order to read them you need to enable the ADC line as a digital output, drain a capacitor, set the ADC line back to analog input, wait for the capacitor to charge, and finally read it. It's a simple enough algorithm, but it's handy to have if you use these sensors with an Orangutan.

qti10(channel) / qti8(channel)

Both of these read a QTI sensor plugged into the ADC channel of your choice. One reads it in 10-bit mode, the other in 8-bit mode. qti10() returns a 16-bit unsigned int, qti8() returns an 8-bit unsigned int. There is no QTI-specific initialization, but the analog subsystem must be initialized prior to calling either routine.

srf08.h / srf08.c


The Devantech SRF08 sonar module can communicate to a microcontroller using the I2C bus. For the moment please refer to the srf08.c/h source code for documentation. This is a work in progress.