Skip to content

Commit

Permalink
closes hneemann#1279
Browse files Browse the repository at this point in the history
  • Loading branch information
hneemann committed Apr 20, 2024
1 parent 468972d commit f7c58f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/java/de/neemann/digital/core/Signal.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public String getValueString() {

/**
* Returns true if this signal is a valid signal.
* Valid means there is a name and the value is non null
* Valid means there is a name and the value is not null
*
* @return true if signal is valid
*/
Expand Down
21 changes: 12 additions & 9 deletions src/main/java/de/neemann/digital/core/io/Out.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,18 @@ public String getDescription(ElementAttributes elementAttributes) {
.addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL)
.addAttribute(Keys.LED_SIZE)
.addAttribute(Keys.ADD_VALUE_TO_GRAPH)
.addAttribute(Keys.COLOR);

/**
* The polarity aware LED description
*/
public static final ElementTypeDescription POLARITYAWARELEDDESCRIPTION
= new ElementTypeDescription("PolarityAwareLED",
attributes -> new Out(1, 1), input("A"), input("C"))
attributes -> new Out(attributes, 1, 1), input("A"), input("C"))
.addAttribute(Keys.ROTATE)
.addAttribute(Keys.LABEL)
.addAttribute(Keys.ADD_VALUE_TO_GRAPH)
.addAttribute(Keys.COLOR);

/**
Expand All @@ -71,7 +73,7 @@ public String getDescription(ElementAttributes elementAttributes) {
*/
public static final ElementTypeDescription SEVENHEXDESCRIPTION
= new ElementTypeDescription("Seven-Seg-Hex",
attributes -> new Out(4, 1), input("d"), input("dp"))
attributes -> new Out(attributes, 4, 1), input("d"), input("dp"))
.addAttribute(Keys.COLOR)
.addAttribute(Keys.SEVEN_SEG_SIZE);

Expand All @@ -80,7 +82,7 @@ public String getDescription(ElementAttributes elementAttributes) {
*/
public static final ElementTypeDescription SIXTEENDESCRIPTION
= new ElementTypeDescription("SixteenSeg",
attributes -> new Out(16, 1), input("led"), input("dp"))
attributes -> new Out(attributes, 16, 1), input("led"), input("dp"))
.addAttribute(Keys.COLOR)
.addAttribute(Keys.SEVEN_SEG_SIZE);

Expand Down Expand Up @@ -108,14 +110,15 @@ public Out(ElementAttributes attributes) {
/**
* Creates a new instance
*
* @param bits the bitcount of the different inputs
* @param attributes the attributes
* @param bits the bitcount of the different inputs
*/
public Out(int... bits) {
public Out(ElementAttributes attributes, int... bits) {
this.bits = bits;
label = null;
label = attributes.getLabel();
pinNumber = "";
formatter = null;
showInGraph = true;
showInGraph = attributes.get(Keys.ADD_VALUE_TO_GRAPH);
}

@Override
Expand Down Expand Up @@ -151,9 +154,9 @@ private final static class SevenSegTypeDescription extends ElementTypeDescriptio
private SevenSegTypeDescription() {
super("Seven-Seg", attributes -> {
if (attributes.get(Keys.COMMON_CONNECTION))
return new Out(1, 1, 1, 1, 1, 1, 1, 1, 1);
return new Out(attributes, 1, 1, 1, 1, 1, 1, 1, 1, 1);
else
return new Out(1, 1, 1, 1, 1, 1, 1, 1);
return new Out(attributes, 1, 1, 1, 1, 1, 1, 1, 1);
});
addAttribute(Keys.COLOR);
addAttribute(Keys.COMMON_CONNECTION);
Expand Down

0 comments on commit f7c58f2

Please sign in to comment.