forum.getinpulse.com
http://www.getinpulse.com/hack/forum/

Fortune (Day 15)
http://www.getinpulse.com/hack/forum/viewtopic.php?f=7&t=277
Page 1 of 1

Author:  hudson [ Sun May 08, 2011 6:06 pm ]
Post subject:  Fortune (Day 15)


Today is halfway through the month!

This watch displays a series of quotes relating to time, the seasons, etc with a stylized typerwriter appearance. The text of the quotes are stored in flash and the currently selected, random quote is loaded dynamically into RAM for display. The read routine is copied from ajwitte's spiflash.h:
// prototype of private API function for raw SPI flash reads
void spiflash_read(int addr, void *buffer, int size);

The offset address is 0x40000 + length of the other resources. My Makefile determines the length of the resources at compile time by running:
include/app_resources.h: resources/fonts.txt
        $(PYTHON) $(TOOLSDIR)/resource_packer/resource_packer.py
        echo > include/spi_resources.h "#define SPIFLASH_OFFSET `stat -f "%z" resources/inpulse_resources.bin`"

The fortunes are then pre-processed by make-fortunes perl script and find_random_saying() will read one from the flash.

Video: http://www.flickr.com/photos/osr/570192 ... 084215019/
Source: https://bitbucket.org/hudson/watches/src/tip/fortune/

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/