WiFiChron support for 16-segment LED display
This is the second time I am writing this post. First time it just disappeared after almost 2 hours of editing. I started the post by saying that whenever I want to have some electronics fun, I open one of my drawers. Nice story line, but I am too frustrated now to recreate it from memory. (The lesson I learned is that I should write it first as a document, save locally, then copy and paste into a blog post.)
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:
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
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.
For WiFiChron, two cascaded modules make an 8-character display functionally similar to HDSP-2534, but bigger and more visible. With the "Display Abstraction Layer" already in place, software support should be easy to integrate, since controlling it with the HT16K33 breakout allows the re-use of the above mentioned Adafruit LED backpack library. For maximum compatibility, I followed the same wiring, then connected the two extra segments, A2 and D2, to pin 10 (not connected for the 14-segment backpack) and pin 11 (connected to the DP), respectively.
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
In principle, any display that can show 8 characters can be used through DAL.
[original story: Wise time with Arduino]
