WiFiChron support for 16-segment LED display
So I will keep it short and dry.
Some time ago, I designed this "4-character 16-segment 1-inch LED" board (pictured below), briefly mentioned here. I abandoned it, after a couple of failed tries, while writing the character definitions. Since then, I discovered the Adafruit 4-char alphanumeric LED backpack, which comes with nice software support as well.
I added a new class, Alphanum8x16, to the original files (Adafruit_LEDBackpack.h and cpp) to control the extra segments:
class Alphanum8x16 : public Adafruit_AlphaNum4
{
public:
void writeDigitAscii(uint8_t n, uint8_t ascii);
};
The 8x16-segment display is implemented in class DisplayHT16K33 in the WiFiChron software.
void Alphanum8x16::writeDigitAscii(uint8_t n, uint8_t a)
{
uint16_t font = pgm_read_word(alphafonttable+a);
displaybuffer[n] = font;
//--------------------------------------------------------
// this is the Adafruit mapping of digits to segments:
// 0 DP N M L K J H G2 G1 F E D C B A
//
// this is the 16 seg mapping of digits to segments:
// A2 D2 N M L K J H G2 G1 F E D1 C B A1
//
// bits:
// 1 1 1 ... ... 1 0
// 5 4 3
//
// Note: DP is not connected/controlled for the 16 seg;
//--------------------------------------------------------
// if A1 (bit 0) is on, set A2 (bit 15) as well;
if (font & 1)
displaybuffer[n] |= 0x8000;
// if D1 (bit 3) is on, set D2 (bit 14) as well;
if (font & 8)
displaybuffer[n] |= 0x4000;
}
So far, WiFiChron can support the following displays (defines in DAL.h):
//#define DISPLAY_HDSP2534
//#define DISPLAY_DL1414
#define DISPLAY_HT16K33
//#define DISPLAY_OLED
//#define DISPLAY_HT1632
//#define DISPLAY_MAX6955