This is only for the 128x64 display!!!! I took out all the code for the larger display.I only own the small one and this was all I could test. others are welcome to adapt the code if they want.

interface stuff:

default baud is still 115200, and will revert to this when a character is sent during the splash screen

** The display now implements XON/XOFF flow control. If your application supports this, you can re-compile the code with a smaller RX_BUFFER_SIZE value to make more room for sprites. The default RX_BUFFER_SIZE is the 256 max. If you are going to BitBlt large images I recommend implementing XON/XOFF or you may overrun the buffer. You could also put a delay in your host code if you overrun the buffer while BitBlt'ing a large image.

ASCII characters sent to the display will be printed left to right, top to bottomcommands are still prefaced by 0x7C** there are basic debug messages that get sent when command mode is entered and exited, these are set with command 0x02 0x## with ##=(0,1,2) 0= no messages, 1=binary format messages, 2=ascii format messages. the messages are sent out on the uart** there is an LCD reset command that resets the LCD should things get screwy, command 0x06. (pulls /RESET low, then high, clears the screen and sets x_offset=0, y_offset=0)

Text stuff:

**display now responds to carrige returns and line feeds. by default a carrige return also executes a line feed. you can toggle this with command 0x04**there is no more demo mode**text rendering is much faster**you can define your own fonts, however you must decide what fonts you want at compile time. All font data is in two files font.h and aux_font.h, replace them with your own fonts if you wish. There is a utility called bmp2header_font which will create a font.h file from a bitmap(one large image with characters sequential in the x direction), not you must manually rename text_array to aux_text array in the header if you want to use it for aux_font.h**by default the code builds with the original Sparkfun font in default, and a double sized font in aux, you can switch back and forth with command 0x08**the text is now rendered using the bitblt function, so you can use all the logical modes(0..7) for drawing text, set the mode with command 0x0A 0x##.

Graphical stuff:**the coordinate system is now (0,0) in upper left and increasing right and down**the line and circle algorithms have been replaced to use only integer math (Bresenham's line algorithm and midpoint circle algorithm)**support for NUM_SPRITES sprites labled 0..(NUM_SPRITES-1). each sprite has SPRITE_SIZE bytes of data dedicated to it. the default #defines in the code set these numbers to 8 sprites of 34 bytes each, you can change this if you want, but be careful not to use up all the SRAM, the ATmega168 only has 1K. 34 bytes/sprite is enough for a 16x16 block, although sprites don't have to be square. command 0c0B draws a sprite, the sparkfun logo is sprite 0, but this can be overwritten. Command 0x0D uploads a sprite.**draw filled box command. this draws a box filled with a repeating byte(virtical stripe of data) ie 0x00 would clear every pixel, 0xFF would set them, 0xAA would draw stripes** bitblt if you want to draw something larger than a sprite.**raw read/write functions: write_command, write_data, write_block, read_data, read_byte, read_block**reverse mode now inverts the graphics on the screen instead of clearing it.

Command list:all commands must start with 0x7C, this tells the display that the following bytes are part of a command

0x00: clear screen, no other bytes (ex 0x7c 0x00) clears/sets all pixels on the screen(depending on if reverse is set) sets x_offset and y_offset to 0

0x01: set debug level, follow with byte for debug level(0,1,2) level 0 is no messages level 1 is binary messages, the display will echo a byte = command when the command is started and a byte = 0x00 when the command is finished level 2 is text messages, useful when using a terminal. will echo "Entered Command n" when command n is started and will echo "Exited Command n, RX_buffer=y" when the command is done, and will report how many bytes are in the recieve buffer

0x02: set backling duty cycle. argument is duty cycle in percent ie (0..100) ex: 0x7C 0x02 0x32 will set the backlight to 50%

0x03: draw circle. arguments are x, y, radius, set/reset. so command (0x7C 0x03 0x20 0x20 0x0A 0x01) will draw a circle at (32,32) with a radius of 10 by setting the pixels

0x04: toggles CR/LF. each time this command is sent, wheather or not a CR automatically executes a LF is toggled. this is saved to EEPROM and is persistant over power cycles

0x05: erase block. draws a block on the screen with clear(reverse=0) or set(reverse=1) pixels arcuments are x1,y1,x2,y2 the coordinates of two opposite corners of the block. ex: (0x7C 0x05 0x00 0x00 0x10 0x10) clears from (0,0) to (16,16)

0x06: LCD reset. resets the LCD, clears the screen, and sets x_offset and y_offset to 0