ksegment7(ports)

koadrobot/devices/ksegment7(ports)

No description
ksegment7(ports)
@/ksegment7(ports)
Gport
Fport
Eport
Dport
Cport
Bport
Aport
Dtport
Dot point
Nnumber
Number that display. (0..15) (0..F)
DOTboolean
Display Dot.
PULLboolean
HW kind of segment: False: common Anode ( power pin connect VCC.)
UPDpulse
Triggers new write
ksegment7(ports)
DONE
G
F
E
D
C
B
A
Dt
N
DOT
PULL
UPD
DONEpulse
Fires on writing complete
To use the node in your project you should have the koadrobot/devices library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto _in = getValue<input_IN>(ctx);
    uint8_t _out;

    // Bpgfedcba
    switch (_in){
        case 0 : _out= B00111111;break;//63
        case 1 : _out= B00000110;break;//6
        case 2 : _out= B01011011;break;//91
        case 3 : _out= B01001111;break;//79
        case 4 : _out= B01100110;break;//102
        case 5 : _out= B01101101;break;//109
        case 6 : _out= B01111101;break;//125
        case 7 : _out= B00000111;break;//7
        case 8 : _out= B01111111;break;//127
        case 9 : _out= B01101111;break;//111
        case 10 : _out= B01110111;break;//119
        case 11 : _out= B01111100;break;//124
        case 12 : _out= B00111001;break;//57
        case 13 : _out= B01011110;break;//94
        case 14 : _out= B01111001;break;//121
        case 15 : _out= B01110001;break;//57
    }


   if(getValue<input_Dt>(ctx)) _out |= 0x80;

   if(!getValue<input_PULL>(ctx)) _out ^= 0xFF;

   ::digitalWrite(getValue<input_Dt>(ctx), 1 & (_out >> 7));
   ::digitalWrite(getValue<input_G>(ctx), 1 & (_out >> 6));
   ::digitalWrite(getValue<input_F>(ctx), 1 & (_out >> 5));
   ::digitalWrite(getValue<input_E>(ctx), 1 & (_out >> 4));
   ::digitalWrite(getValue<input_D>(ctx), 1 & (_out >> 3));
   ::digitalWrite(getValue<input_C>(ctx), 1 & (_out >> 2));
   ::digitalWrite(getValue<input_B>(ctx), 1 & (_out >> 1));
   ::digitalWrite(getValue<input_A>(ctx), 1 & (_out));

   emitValue<output_DONE>(ctx, 1);
}