segnum-to-bit

samele1222/ship-data/segnum-to-bit

No description
segnum-to-bit
@/segnum-to-bit
VALnumber
Value 1 Point ( 0 - F )h
SEGAbyte
SEGBbyte
SEGCbyte
SEGDbyte
SEGEbyte
SEGFbyte
SEGGbyte
SEGPbyte
segnum-to-bit
VAL
SEGA
SEGB
SEGC
SEGD
SEGE
SEGF
SEGG
SEGP
OUT
OUTbyte
To use the node in your project you should have the samele1222/ship-data 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) {
    
    uint8_t val = getValue<input_VAL>(ctx);
    auto SEGA = getValue<input_SEGA>(ctx);
    auto SEGB = getValue<input_SEGB>(ctx);
    auto SEGC = getValue<input_SEGC>(ctx);
    auto SEGD = getValue<input_SEGD>(ctx);
    auto SEGE = getValue<input_SEGE>(ctx);
    auto SEGF = getValue<input_SEGF>(ctx);
    auto SEGG = getValue<input_SEGG>(ctx);
    auto SEGP = getValue<input_SEGP>(ctx);
    const uint8_t FONT_0 = SEGA|SEGB|SEGC|SEGD|SEGE|SEGF;
    const uint8_t FONT_1 = SEGB|SEGC;
    const uint8_t FONT_2 = SEGA|SEGB|SEGD|SEGE|SEGG;
    const uint8_t FONT_3 = SEGA|SEGB|SEGC|SEGD|SEGG;
    const uint8_t FONT_4 = SEGB|SEGC|SEGF|SEGG;
    const uint8_t FONT_5 = SEGA|SEGC|SEGD|SEGF|SEGG;
    const uint8_t FONT_6 = SEGA|SEGC|SEGD|SEGE|SEGF|SEGG;
    const uint8_t FONT_7 = SEGA|SEGB|SEGC;
    const uint8_t FONT_8 = SEGA|SEGB|SEGC|SEGD|SEGE|SEGF|SEGG;
    const uint8_t FONT_9 = SEGA|SEGB|SEGC|SEGD|SEGF|SEGG;
    const uint8_t FONT_A = SEGA|SEGB|SEGC|SEGE|SEGF|SEGG;
    const uint8_t FONT_B = SEGC|SEGD|SEGE|SEGF|SEGG;
    const uint8_t FONT_C = SEGA|SEGD|SEGE|SEGF;
    const uint8_t FONT_D = SEGB|SEGC|SEGD|SEGE|SEGG;
    const uint8_t FONT_E = SEGA|SEGD|SEGE|SEGF|SEGG;
    const uint8_t FONT_F = SEGA|SEGE|SEGF|SEGG;

    const uint8_t NUM_MAP[]={
	/*b a f g e d c dp*/
	    FONT_0,    	FONT_1,    	FONT_2,    	FONT_3,
    	FONT_4,    	FONT_5,    	FONT_6,    	FONT_7,
    	FONT_8,    	FONT_9,    	FONT_A,    	FONT_B,
    	FONT_C,    	FONT_D,    	FONT_E,    	FONT_F,
    };
    emitValue<output_OUT>(ctx, NUM_MAP[val%0x10]);
}