# HG changeset patch # User František Kučera # Date 1514068966 -3600 # Node ID cb2055cdc2f09ac38b4af0d3f8da50375f6db7f8 # Parent ae4a9092e1a8bffb09518ae750376cd15a43293d SLEEP in class diff -r ae4a9092e1a8 -r cb2055cdc2f0 c++/rgb-assembler/commands/Sleep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c++/rgb-assembler/commands/Sleep.h Sat Dec 23 23:42:46 2017 +0100 @@ -0,0 +1,25 @@ +#pragma once + +#include +#include +#include + +#include "../Command.h" + +using namespace std; + +namespace commands { + +class Sleep : public Command { +public: + + void process(octet_t* memory, address_t& index) override { + sleep_t delay = read(memory, index); + wprintf(L"SLEEP %*d ms\n", 4, delay); + this_thread::sleep_for(chrono::milliseconds(delay)); + } +private: + +}; + +} diff -r ae4a9092e1a8 -r cb2055cdc2f0 c++/rgb-assembler/nbproject/configurations.xml --- a/c++/rgb-assembler/nbproject/configurations.xml Sat Dec 23 23:34:21 2017 +0100 +++ b/c++/rgb-assembler/nbproject/configurations.xml Sat Dec 23 23:42:46 2017 +0100 @@ -6,6 +6,7 @@ projectFiles="true"> Command.h commands/Goto.h + commands/Sleep.h memory.h types.h @@ -48,6 +49,8 @@ + + @@ -80,6 +83,8 @@ + + diff -r ae4a9092e1a8 -r cb2055cdc2f0 c++/rgb-assembler/rgb-assembler.cpp --- a/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:34:21 2017 +0100 +++ b/c++/rgb-assembler/rgb-assembler.cpp Sat Dec 23 23:42:46 2017 +0100 @@ -4,13 +4,12 @@ #include #include #include -#include -#include #include "types.h" #include "memory.h" #include "Command.h" #include "commands/Goto.h" +#include "commands/Sleep.h" using namespace std; @@ -114,6 +113,7 @@ unordered_map> commands = { {CMD_GOTO, make_shared()}, + {CMD_SLEEP, make_shared()}, }; for (address_t i = 0; i < MEMORY_SIZE;) { @@ -131,13 +131,6 @@ } switch (command) { - case CMD_SLEEP: - { - sleep_t delay = read(memory, i); - wprintf(L"SLEEP %*d ms\n", 4, delay); - this_thread::sleep_for(chrono::milliseconds(delay)); - break; - } case CMD_COLOR: { led_t led = read(memory, i);