# HG changeset patch # User František Kučera # Date 1513897204 -3600 # Node ID efed38f454a06b784dedd50ee75b5634e29d76e5 # Parent 157bc062efa7fac5216a921de0731a03338b5286 COLOR diff -r 157bc062efa7 -r efed38f454a0 c++/rgb-assembler/rgb-assembler.cpp --- a/c++/rgb-assembler/rgb-assembler.cpp Thu Dec 21 21:55:26 2017 +0100 +++ b/c++/rgb-assembler/rgb-assembler.cpp Fri Dec 22 00:00:04 2017 +0100 @@ -12,11 +12,13 @@ typedef uint16_t address_t; typedef uint8_t command_t; typedef uint8_t sleep_t; +typedef uint8_t color_t; const address_t MEMORY_SIZE = 1024; const command_t CMD_GOTO = 0x70; const command_t CMD_SLEEP = 0xFF; +const command_t CMD_COLOR = 0xAA; const command_t CMD_END = 0xED; /** @@ -61,6 +63,10 @@ write(memory, a, 1); write(memory, a, CMD_SLEEP); write(memory, a, 255); + write(memory, a, CMD_COLOR); + write(memory, a, 50); + write(memory, a, 100); + write(memory, a, 150); write(memory, a, CMD_END); } @@ -70,6 +76,10 @@ wprintf(L"%X\n", ch); string command; + + color_t r; + color_t g; + color_t b; switch (ch) { case CMD_GOTO: @@ -80,6 +90,12 @@ command.append("SLEEP"); this_thread::sleep_for(chrono::milliseconds(read(memory, i))); break; + case CMD_COLOR: + command.append("COLOR"); + r = read(memory, i); + g = read(memory, i); + b = read(memory, i); + break; case CMD_END: command.append("END"); i = MEMORY_SIZE;