From f8f8a7a283e821b57144f6ee4b7419de06c3b3fa Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 9 Nov 2023 19:53:37 +0100 Subject: [PATCH 1/5] Add segment name definitions --- Adafruit_LEDBackpack.h | 16 +++++++ .../quadalphaanimation/quadalphaanimation.ino | 42 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 examples/quadalphaanimation/quadalphaanimation.ino diff --git a/Adafruit_LEDBackpack.h b/Adafruit_LEDBackpack.h index b34ae15..b81317e 100644 --- a/Adafruit_LEDBackpack.h +++ b/Adafruit_LEDBackpack.h @@ -50,6 +50,22 @@ #define SEVENSEG_DIGITS 5 ///< # Digits in 7-seg displays, plus NUL end +#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. */ diff --git a/examples/quadalphaanimation/quadalphaanimation.ino b/examples/quadalphaanimation/quadalphaanimation.ino new file mode 100644 index 0000000..aae912f --- /dev/null +++ b/examples/quadalphaanimation/quadalphaanimation.ino @@ -0,0 +1,42 @@ +// This example shows how to use the alphanumeric segment names in an animation. +// +// Author: Jonny Bergdahl (github@bergdahl.org) +// +#include +#include + +Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4(); +// Defines the animation. For segment names, +// see https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/usage +uint16_t animation[] { 0, ALPHANUM_SEG_A, + 1, ALPHANUM_SEG_H, + 1, ALPHANUM_SEG_N, + 2, ALPHANUM_SEG_L, + 2, ALPHANUM_SEG_K, + 3, ALPHANUM_SEG_A, + 3, ALPHANUM_SEG_B, + 3, ALPHANUM_SEG_C, + 3, ALPHANUM_SEG_D, + 2, ALPHANUM_SEG_N, + 2, ALPHANUM_SEG_H, + 1, ALPHANUM_SEG_K, + 1, ALPHANUM_SEG_L, + 0, ALPHANUM_SEG_D, + 0, ALPHANUM_SEG_E, + 0, ALPHANUM_SEG_F }; + +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); + } +} \ No newline at end of file From b23cc6c62811d9aefcfbc94ecf84b316b6d12cb1 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 9 Nov 2023 20:08:22 +0100 Subject: [PATCH 2/5] Fix clang-format complaints --- Adafruit_LEDBackpack.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Adafruit_LEDBackpack.h b/Adafruit_LEDBackpack.h index b81317e..282e579 100644 --- a/Adafruit_LEDBackpack.h +++ b/Adafruit_LEDBackpack.h @@ -50,20 +50,20 @@ #define SEVENSEG_DIGITS 5 ///< # Digits in 7-seg displays, plus NUL end -#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_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_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 /*! From 51d44ad4c72a4b016a158919bab2595aa8ae2eae Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 9 Nov 2023 20:12:29 +0100 Subject: [PATCH 3/5] Clang complaint... --- Adafruit_LEDBackpack.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Adafruit_LEDBackpack.h b/Adafruit_LEDBackpack.h index 282e579..d9e9fb3 100644 --- a/Adafruit_LEDBackpack.h +++ b/Adafruit_LEDBackpack.h @@ -56,15 +56,15 @@ #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_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 +#define ALPHANUM_SEG_DP 0b0100000000000000 ///< Alphanumeric segment DP /*! @brief Class encapsulating the raw HT16K33 controller device. From 3b2c3335feafd58b5a171c43dfb117dd1b6370a9 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sun, 12 Nov 2023 13:49:54 +0100 Subject: [PATCH 4/5] Added ASCII for the 14 digit alphanumeric display --- Adafruit_LEDBackpack.h | 19 ++++++++++++++++ README.md | 6 +++++ .../quadalphaanimation/quadalphaanimation.ino | 22 +++++++++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Adafruit_LEDBackpack.h b/Adafruit_LEDBackpack.h index d9e9fb3..4e594e8 100644 --- a/Adafruit_LEDBackpack.h +++ b/Adafruit_LEDBackpack.h @@ -50,6 +50,25 @@ #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 diff --git a/README.md b/README.md index e96d749..f61c1ed 100644 --- a/README.md +++ b/README.md @@ -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 & 21 ATSAM21D | X | | | @@ -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 diff --git a/examples/quadalphaanimation/quadalphaanimation.ino b/examples/quadalphaanimation/quadalphaanimation.ino index aae912f..851358e 100644 --- a/examples/quadalphaanimation/quadalphaanimation.ino +++ b/examples/quadalphaanimation/quadalphaanimation.ino @@ -6,8 +6,26 @@ #include Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4(); -// Defines the animation. For segment names, -// see https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/usage + +/* +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, 1, ALPHANUM_SEG_H, 1, ALPHANUM_SEG_N, From 34a31a20cc2a94c2740eb63bc898630c2a65cd56 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sun, 12 Nov 2023 14:08:51 +0100 Subject: [PATCH 5/5] Changed animation --- .../quadalphaanimation/quadalphaanimation.ino | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/quadalphaanimation/quadalphaanimation.ino b/examples/quadalphaanimation/quadalphaanimation.ino index 851358e..fe78056 100644 --- a/examples/quadalphaanimation/quadalphaanimation.ino +++ b/examples/quadalphaanimation/quadalphaanimation.ino @@ -26,22 +26,22 @@ See https://learn.adafruit.com/14-segment-alpha-numeric-led-featherwing/usage -------D------- DP */ -uint16_t animation[] { 0, ALPHANUM_SEG_A, - 1, ALPHANUM_SEG_H, - 1, ALPHANUM_SEG_N, - 2, ALPHANUM_SEG_L, - 2, ALPHANUM_SEG_K, - 3, ALPHANUM_SEG_A, - 3, ALPHANUM_SEG_B, - 3, ALPHANUM_SEG_C, - 3, ALPHANUM_SEG_D, - 2, ALPHANUM_SEG_N, - 2, ALPHANUM_SEG_H, - 1, ALPHANUM_SEG_K, - 1, ALPHANUM_SEG_L, - 0, ALPHANUM_SEG_D, - 0, ALPHANUM_SEG_E, - 0, ALPHANUM_SEG_F }; +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);