ECE497 Notes on Adafruit

Here are notes on using using various Adafruit things. The main Adafruit git repository is here.

LED Backpack
Here are some leads for interfacing the Small 1.2" 8x8 Bi-Color (Red/Green) Square LED Matrix.

git repositories:
 * LED Backpack
 * GFX Library, used by LED Backpack
 * Arduino, defines Wire.

The LED backpack using the HT16K33 LED controller.

The LED startup sequence seems to be:


 * Send 0x21 to start the oscillator (Page 10)
 * Send 0x81 to turn the display on and blinking off (Page 11)
 * Send 0xef to set brightness to full (Page 15)
 * Send 0x00 to start adding at 0 (Page 13)

A command summary starts on page 30.

This will dump some of the registers

i2cdump -y -r 0-0x0f 3 0x70 b

Setting address 0xa3 turns on a row of LEDS, but hangs the device.

myi2ctest.c
I'm able to control the RED LED matrix. The code is in myi2ctest.c.

Adapting LED-Backpack-Library
I try adapting the Adafruit-LED-Backpack-Library and Adafruit-GFX-Library to using the Linux i2c drivers, but it's not compiling yet. There's a problem with vtable not being defined.

Some things I did for the conversion: typedef __u8	uint8_t; typedef __s8	int8_t; typedef __u16	uint16_t; typedef __s16	int16_t; typedef char	boolean;
 * There are different type declarations. In hack.h I mapped them using:


 * I mapped usleep to delay
 * 1) define delay(x)	usleep(1000*x)


 * Arudino has separate instruction (32K) and data (2K) spaces. If you have a large table it common to put it into the instruction space .  This is done using PROGMEM.  The data is read with '''pgm_read_byte'  Here are my mappings.
 * 1) define PROGMEM
 * 2) define pgm_read_byte(x)	*(x)


 * _BV is used to set a given bit.
 * 1) define _BV(bit) (1 << (bit))

extern "C" { int lookup_i2c_bus(const char *i2cbus_arg); int parse_i2c_address(const char *address_arg); int open_i2c_dev(int i2cbus, char *filename, size_t size, int quiet); int set_slave_addr(int file, int address, int force); }
 * You need the following to call C functions from C++


 * The -fno-rtti flag is needed when compiling to removed a undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'  error

extern "C" void __cxa_pure_virtual(void) { // call to a pure virtual function happened ... wow, should never happen ... stop while(1); }
 * The __cxa_pure_virtual error is removed with

But even with all this work it's still not compiling!