Wednesday, May 28, 2014

Arduino Library for GLO-216 and GLO-416

An Arduino library for the GLO- series displays has just been released. The library contains a collection of macros that automatically write Arduino code for the most common display-formatting tasks, such as:
  • Cursor positioning: gloSetCursor( col,row )
  • Setting font size: gloFont_1w1h thru gloFont_4w4h
  • Custom character definition: gloCreateChar( ccnum, patarray )
  • Custom character display: gloCustomChar( ccnum )
  • Right-alignment: gloSetCursorAlignRight( col, row, width )
  • Startup Screen creation: gloSaveStartScreen 
  • ...the entire GLO instruction set
The library includes 10 example programs; five each for UART and SoftwareSerial interfacing (with a fix for the soft-serial startup bug). The UART examples have been tested on a MEGA 2560 and 32-bit DUE; the SoftwareSerial examples on  a MEGA 2560 and UNO.

Wednesday, May 7, 2014

Simple Fix for Arduino SoftwareSerial "setTX" Bug

There's a minor but annoying bug in Arduino's SoftwareSerial library that can trash the first few bytes sent after setup when "inverse" mode is used. It's been a known issue for some time, but is still unfixed in the current version of the library.

The problem is in the "setTX" method in the file "SoftwareSerial.cpp" located in the SoftwareSerial subdirectory of the Libraries folder. This code should set the tx pin output/HIGH for UART-polarity serial, and output/LOW for inverted serial. Unfortunately, it ignores the "inverse" case entirely:

void SoftwareSerial::setTX(uint8_t tx)
{
  pinMode(tx, OUTPUT);
  digitalWrite(tx, HIGH);