An update on the latest improvements and development of Cosa. The latest focus has been on LCD Displays. In Cosa simple mono-chrome displays are IOStream::Device's which allows printout directly to screen. They also implement handling of a number of special character (when possible):
- Carriage-return/line-feed (\n)
- Form feed (\f) => clear display and goto home position (0,0)
- Back-space (\b) => one step back on current line (if possible)
- Alert/Bell (\a) => toggle text mode (inverted/normal)
- Horizontal tab (\t) => set cursor at next tab position
The drivers support basic scrolling of text. Scrolling is implemented without extra SRAM/copy of the screen. Hardware assisted scrolling, changing display memory registers, is used when possible (e.g. ST7565). In other cases simple wrap-around is used. Carriage-return/line-feed will clear the new line.
The following mono-chrome LCD devices are currently supported; ST7565 64x128, PCD8544 48x84, and HD44780 (aka 1602/2004) 16x2/20x4 character LCD. Pixel based LCD device drivers do not support the Canvas drawing operations directly. Instead there is an Offscreen canvas that can be used. This design allows SRAM to be used more efficiently.
Above are the Cosa classes that support the IOStream::Device interface and can be used with IOStream and replace each other. The ST7735, 262K Color Single-Chip TFT device driver supports the Cosa Canvas interface and all drawing operations with IOStream::Device as Textbox element(s) on screen.
Please find the LCD device driver documentation on-line:
- HD44780 http://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/dd/dd2/classHD44780.html#pub-methods
- PCD8544 http://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/da/d71/classPCD8544.html#pub-methods
- ST7565 http://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/d7/d72/classST7565.html#pub-methods
- ST7735 http://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/dc/d6e/classST7735.html#pub-methods
Last, the Cosa LCD drivers work on Arduino Mega, Mighty, Uno, Nano, Mini, etc, all the way down to ATtinyX4/X5. Below is an ATtiny85 running an example sketch with PCD8544 LCD and RF433/Virtual Wire Interface (VWI) receiver. The sketch receives humidity and temperature (DHT11) readings from the ATtiny in the background and displays the reading together with sequence number, message drop statistics, battery voltage and run-time. Note the diode to lower the Lithium 3.7V for the LCD ( https://github.com/mikaelpatel/Cosa/blob/master/examples/Tiny/CosaTinyReceiver/CosaTinyReceiver.ino
There is a simple "hello world" sketch that can be used to get some statistics on the foot print of the LCD drivers. Cosa/CosaLCDsize.ino at master · mikaelpatel/Cosa · GitHub
Below is the sketch size in bytes for Arduino Mega/Standard/Tiny builds for the mono-chrome LCD drivers.
- HD44780: 3312/3088/2868 bytes
- PCD8544: 4482/4260/3916 bytes
- ST7565: 5008/4802/4460 bytes
Please note that Cosa does not currently support Arduino Due, Leonardo and other ATmega32u4 based boards.
Cheers!