by pocketmoon on Sun Jan 26, 2014 4:59 pm

It's cool just how much you can hang off a Trinket!

I now have a 3.3v Trinket talking too:
over I2C;
DS1307 Real Time Clock (includes 24C32 32K Bit I2C EEPROM memory which is also visible on the I2C bus)
HMC5883L 3 Axis Compass Magnetometer
PCF8574 - Remote 8-Bit I/O Expander for I2C-Bus

Over SPI;
OLED 128x64 SSD1306
23K256 SRAM Chip - 32K of lovely SPI accessible memory.

The SRAM provides a screenbuffer for the OLED module, which has no built in RAM. To draw the buffer to the display I read a 'page' worth of data (128 Bytes) at a time from the framebuffer and push these to the OLED, both over SPI. So a local 128 byte buffer is needed in the Trinket.

All the Trinket pins are in use so I use a small switch to disconnect #3 and #4 during proramming.

With SPI you need a separate Slave Select line for each device. These are provided by the PCF8574 which is an I2C IO Expander. I write to this first (over I2C) to select one of the output pins which act as Slave Selects for each SPI device. The outputs (I'm using 2) are then AND'ed with a single Master SS (on #3). This allows the individual SS's to be driven low by the master SS.

Code eequires a bit of jumping between I2C mode and SPI mode and both are using the serial hardware on the ATTiny.

The display in the photo shows the time, a compass reading and a time per frame in milliseconds. So it's running about 13fps with room for optimisation.

So all the chips you see are either I2C and SPI apart from a single 2-input AND gate, and the Cyberman,

Cheers

Rob
Attachments
trnk.jpg
trnk.jpg (253.65 KiB) Viewed 431 times
pocketmoon
 
Posts: 43
Joined: Fri Dec 27, 2013 7:21 pm

by thekitty on Sun Jan 26, 2014 6:07 pm

Very impressive. How big is your code?
thekitty
 
Posts: 418
Joined: Sat Mar 24, 2012 7:56 pm
Location: Mid-Atlantic

by pocketmoon on Mon Jan 27, 2014 4:30 am

Hi,

At the moment I have about 20 bytes free. But there's a fair bit of debug code (flashing leds, etc) and duplicate code across the libraries. So next step is to refactor and trip out the fat.

Cheers

Rob
pocketmoon
 
Posts: 43
Joined: Fri Dec 27, 2013 7:21 pm