Skip to content

Commit

Permalink
Merge pull request #76 from jonnybergdahl/master
Browse files Browse the repository at this point in the history
Add segment name definitions for alphanumeric displays
  • Loading branch information
dhalbert authored Nov 12, 2023
2 parents b71d271 + 34a31a2 commit 74cf652
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Adafruit_LEDBackpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,41 @@

#define SEVENSEG_DIGITS 5 ///< # Digits in 7-seg displays, plus NUL end

/*
Segment names for 14-segment alphanumeric displays.
See https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/usage
-------A-------
|\ | /|
| \ J / |
| H | K |
F \ | / B
| \|/ |
|--G1--|--G2--|
| /|\ |
E / | \ C
| L | N |
| / M \ |
|/ | \|
-------D------- DP
*/

#define ALPHANUM_SEG_A 0b0000000000000001 ///< Alphanumeric segment A
#define ALPHANUM_SEG_B 0b0000000000000010 ///< Alphanumeric segment B
#define ALPHANUM_SEG_C 0b0000000000000100 ///< Alphanumeric segment C
#define ALPHANUM_SEG_D 0b0000000000001000 ///< Alphanumeric segment D
#define ALPHANUM_SEG_E 0b0000000000010000 ///< Alphanumeric segment E
#define ALPHANUM_SEG_F 0b0000000000100000 ///< Alphanumeric segment F
#define ALPHANUM_SEG_G1 0b0000000001000000 ///< Alphanumeric segment G1
#define ALPHANUM_SEG_G2 0b0000000010000000 ///< Alphanumeric segment G2
#define ALPHANUM_SEG_H 0b0000000100000000 ///< Alphanumeric segment H
#define ALPHANUM_SEG_J 0b0000001000000000 ///< Alphanumeric segment J
#define ALPHANUM_SEG_K 0b0000010000000000 ///< Alphanumeric segment K
#define ALPHANUM_SEG_L 0b0000100000000000 ///< Alphanumeric segment L
#define ALPHANUM_SEG_M 0b0001000000000000 ///< Alphanumeric segment M
#define ALPHANUM_SEG_N 0b0010000000000000 ///< Alphanumeric segment N
#define ALPHANUM_SEG_DP 0b0100000000000000 ///< Alphanumeric segment DP

/*!
@brief Class encapsulating the raw HT16K33 controller device.
*/
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Atmega328 @ 12MHz | X | | |
Atmega32u4 @ 16MHz | X | | |
Atmega32u4 @ 8MHz | X | | |
ESP8266 | X | | |
ESP32 | X | | |
ESP32S2 | X | | |
ESP32S3 | X | | |
Atmega2560 @ 16MHz | X | | |
ATSAM3X8E | X | | | Use SDA/SCL on pins 20 &amp; 21
ATSAM21D | X | | |
Expand All @@ -21,6 +24,9 @@ ATtiny85 @ 8MHz | X | | | Use 0 for SDA, 2 f
* ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0
* ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro
* ESP8266 : Adafruit Huzzah
* ESP32 : Unexpected Maker tinyPICO
* ESP32S2 : Unexpected Maker tinyS2
* ESP32S3 : Unexpected Maker tinyS3
* ATmega2560 @ 16MHz : Arduino Mega
* ATSAM3X8E : Arduino Due
* ATSAM21D : Arduino Zero, M0 Pro
Expand Down
60 changes: 60 additions & 0 deletions examples/quadalphaanimation/quadalphaanimation.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// This example shows how to use the alphanumeric segment names in an animation.
//
// Author: Jonny Bergdahl ([email protected])
//
#include <Arduino.h>
#include <Adafruit_LEDBackpack.h>

Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();

/*
Segment names for 14-segment alphanumeric displays.
See https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/usage
-------A-------
|\ | /|
| \ J / |
| H | K |
F \ | / B
| \|/ |
|--G1--|--G2--|
| /|\ |
E / | \ C
| L | N |
| / M \ |
|/ | \|
-------D------- DP
*/

uint16_t animation[] { 0, ALPHANUM_SEG_A | ALPHANUM_SEG_D,
1, ALPHANUM_SEG_H | ALPHANUM_SEG_L,
1, ALPHANUM_SEG_N | ALPHANUM_SEG_K,
2, ALPHANUM_SEG_L | ALPHANUM_SEG_H,
2, ALPHANUM_SEG_K | ALPHANUM_SEG_N,
3, ALPHANUM_SEG_A | ALPHANUM_SEG_D,
3, ALPHANUM_SEG_B | ALPHANUM_SEG_C,
3, ALPHANUM_SEG_C | ALPHANUM_SEG_B,
3, ALPHANUM_SEG_D | ALPHANUM_SEG_A,
2, ALPHANUM_SEG_N | ALPHANUM_SEG_K,
2, ALPHANUM_SEG_H | ALPHANUM_SEG_L,
1, ALPHANUM_SEG_K | ALPHANUM_SEG_N,
1, ALPHANUM_SEG_L | ALPHANUM_SEG_H,
0, ALPHANUM_SEG_D | ALPHANUM_SEG_A,
0, ALPHANUM_SEG_E | ALPHANUM_SEG_F,
0, ALPHANUM_SEG_F | ALPHANUM_SEG_E };

void setup() {
Serial.begin(9600);
alpha4.begin(0x70); // pass in the address
}

void loop() {
// For each step of the animation, write the value to the given digit
for (int j = 0; j < sizeof(animation)/2; j = j + 2)
{
alpha4.clear();
alpha4.writeDigitRaw(animation[j], animation[j+1]);
alpha4.writeDisplay();
delay(200);
}
}

0 comments on commit 74cf652

Please sign in to comment.