2-digit 0.56 inch 7 segment

This commit is contained in:
Bane Stojkovic
2026-10-06 15:25:37 +02:00
parent 451bca27fd
commit 51418d6252
4 changed files with 42 additions and 9 deletions
@@ -5088,6 +5088,24 @@
<defaultFlag>false</defaultFlag>
<createdOn>2026-10-11T00:00:00.0000000</createdOn>
</org.diylc.core.Template>
<org.diylc.core.Template>
<name>2-Digit 0.56" Common Cathode</name>
<values>
<entry><string>Type</string><diylc.displays.SevenSegmentDisplay_-DisplayType>TwoDigit_0_56_10Pin</diylc.displays.SevenSegmentDisplay_-DisplayType></entry>
<entry><string>Common</string><diylc.displays.SevenSegmentDisplay_-Common>Cathode</diylc.displays.SevenSegmentDisplay_-Common></entry>
</values>
<defaultFlag>false</defaultFlag>
<createdOn>2026-10-11T00:00:00.0000000</createdOn>
</org.diylc.core.Template>
<org.diylc.core.Template>
<name>2-Digit 0.56" Common Anode</name>
<values>
<entry><string>Type</string><diylc.displays.SevenSegmentDisplay_-DisplayType>TwoDigit_0_56_10Pin</diylc.displays.SevenSegmentDisplay_-DisplayType></entry>
<entry><string>Common</string><diylc.displays.SevenSegmentDisplay_-Common>Anode</diylc.displays.SevenSegmentDisplay_-Common></entry>
</values>
<defaultFlag>false</defaultFlag>
<createdOn>2026-10-11T00:00:00.0000000</createdOn>
</org.diylc.core.Template>
<org.diylc.core.Template>
<name>4-Digit 0.36" Common Cathode</name>
<values>
@@ -507,7 +507,7 @@
<changes>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>7-Segment Display - 1-digit 0.56 inch, 4-digit in 0.36 inch and 0.56 inch, and TM1637 driver module</description>
<description>7-Segment Display - 1-digit 0.56 inch, 2-digit 0.56 inch, 4-digit in 0.36 inch and 0.56 inch, and TM1637 driver module</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
@@ -52,7 +52,7 @@ import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "7-Segment Display", category = "Displays & Outputs",
author = "Branislav Stojkovic", description = "7-Segment LED Display (1-Digit, 4-Digit, or TM1637 I2C Driver Module)",
author = "Branislav Stojkovic", description = "7-Segment LED Display (1-Digit, 2-Digit, 4-Digit, or TM1637 I2C Driver Module)",
instanceNamePrefix = "DISP", zOrder = IDIYComponent.COMPONENT,
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME,
enableCache = true)
@@ -96,6 +96,15 @@ public class SevenSegmentDisplay extends AbstractMakerBoard {
"E", "D", "COM1", "C", "DP", "B", "A", "COM2", "F", "G"
};
/**
* The 5621AS, which is the two-digit member of the same 0.56 inch family as the 5641AS. Ten pins
* rather than twelve: there are two digit commons to bring out instead of four, and no pin is
* freed up by that because the segments already account for the rest.
*/
public static final String[] PIN_NAMES_2DIGIT = new String[] {
"E", "D", "DP", "C", "G", "B", "D2", "D1", "F", "A"
};
/**
* Shared by both bare four-digit packages: the 3641AS and the 5641AS differ in size but not in
* pin function, confirmed by the maintainer.
@@ -591,11 +600,13 @@ public class SevenSegmentDisplay extends AbstractMakerBoard {
* until someone reads a datasheet or measures a part.
*/
public enum DisplayType {
// The parts these model: 5161AS for the single digit, 3641AS for the 0.36 inch four-digit
// package and 5641AS for the 0.56 inch one. The two four-digit parts differ in size but share
// a pinout, which is why one array serves both.
// The parts these model: 5161AS for the single digit, 5621AS for the two-digit package, 3641AS
// for the 0.36 inch four-digit package and 5641AS for the 0.56 inch one. The two four-digit
// parts differ in size but share a pinout, which is why one array serves both.
SingleDigit_10Pin("1-Digit 0.56\"", 12.7d, 19.0d, 8.1d, 14.2d, 0d, 15.24d, true, 1,
PIN_NAMES_1DIGIT, null),
TwoDigit_0_56_10Pin("2-Digit 0.56\"", 25.0d, 19.0d, 8.1d, 14.2d, 12.7d, 15.24d, true, 2,
PIN_NAMES_2DIGIT, null),
FourDigit_0_36_12Pin("4-Digit 0.36\"", 30.0d, 14.0d, 5.2d, 9.14d, 7.5d, 10.16d, true, 4,
PIN_NAMES_4DIGIT, null),
FourDigit_0_56_12Pin("4-Digit 0.56\"", 50.3d, 19.0d, 8.1d, 14.2d, 12.7d, 15.24d, true, 4,
@@ -35,8 +35,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
/**
* Basic checks for the seven-segment displays. Three of the four variants are DIP packages that
* straddle their pins with a row either side, and the fourth is a module carrying a single header
* Basic checks for the seven-segment displays. All but one of the variants are DIP packages that
* straddle their pins with a row either side, and the last is a module carrying a single header
* down one edge, so the pin layout is what differs most between them.
*/
public class SevenSegmentDisplayTest {
@@ -75,6 +75,7 @@ public class SevenSegmentDisplayTest {
@Test
public void pinCountFollowsThePackage() {
Assert.assertEquals(10, of(DisplayType.SingleDigit_10Pin).getControlPointCount());
Assert.assertEquals(10, of(DisplayType.TwoDigit_0_56_10Pin).getControlPointCount());
Assert.assertEquals(12, of(DisplayType.FourDigit_0_36_12Pin).getControlPointCount());
Assert.assertEquals(12, of(DisplayType.FourDigit_0_56_12Pin).getControlPointCount());
Assert.assertEquals(4, of(DisplayType.TM1637_Module_4Pin).getControlPointCount());
@@ -87,6 +88,8 @@ public class SevenSegmentDisplayTest {
public void pinNamesAreInDipOrder() {
Assert.assertArrayEquals(new String[] {"E", "D", "COM1", "C", "DP", "B", "A", "COM2", "F", "G"},
SevenSegmentDisplay.PIN_NAMES_1DIGIT);
Assert.assertArrayEquals(new String[] {"E", "D", "DP", "C", "G", "B", "D2", "D1", "F", "A"},
SevenSegmentDisplay.PIN_NAMES_2DIGIT);
Assert.assertArrayEquals(
new String[] {"E", "D", "DP", "C", "G", "D4", "B", "D3", "D2", "F", "A", "D1"},
SevenSegmentDisplay.PIN_NAMES_4DIGIT);
@@ -127,6 +130,7 @@ public class SevenSegmentDisplayTest {
@Test
public void digitCountComesFromThePackage() {
Assert.assertEquals(1, DisplayType.SingleDigit_10Pin.getDigitCount());
Assert.assertEquals(2, DisplayType.TwoDigit_0_56_10Pin.getDigitCount());
Assert.assertEquals(4, DisplayType.FourDigit_0_36_12Pin.getDigitCount());
Assert.assertEquals(4, DisplayType.FourDigit_0_56_12Pin.getDigitCount());
Assert.assertEquals(4, DisplayType.TM1637_Module_4Pin.getDigitCount());
@@ -141,8 +145,8 @@ public class SevenSegmentDisplayTest {
/**
* A driven module brings out no common pins, so its polarity is not something you order -- which
* is why the BOM line omits it. Asked of the variant rather than of its identity, and paired with
* the pin arrangement so that the two cannot quietly become one question: they agree on all four
* variants today, but a single-in-line bare package or a module in a DIP outline would separate
* the pin arrangement so that the two cannot quietly become one question: they agree on every
* variant today, but a single-in-line bare package or a module in a DIP outline would separate
* them.
*/
@Test