c++/rgb-assembler/commands.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 24 Dec 2017 00:17:12 +0100
changeset 28 2b2f8a17d63a
child 29 10d6964e7b4a
permissions -rw-r--r--
move standard commands (codes) to a header file
     1 #pragma once
     2 
     3 // Standard commands
     4 
     5 /**
     6  * Skip to the given address.
     7  * parameter: address_t
     8  */
     9 const command_t CMD_GOTO = 0x70;
    10 
    11 /**
    12  * Compare values on two addresses and go to one of given three addresses.
    13  * parameter: address_t a
    14  * parameter: address_t b
    15  * parameter: address_t GOTO target when a == b
    16  * parameter: address_t GOTO target when a > b
    17  * parameter: address_t GOTO target when a < b
    18  */
    19 const command_t CMD_GOTO_COMPARE = 0x80;
    20 
    21 /**
    22  * Wait given time in ms.
    23  * parameter: sleep_t
    24  */
    25 const command_t CMD_SLEEP = 0xFF;
    26 
    27 /**
    28  * Set RGB LED color.
    29  * parameter: led_t LED number
    30  * parameter: color_t red
    31  * parameter: color_t green
    32  * parameter: color_t blue
    33  */
    34 const command_t CMD_COLOR = 0xAA;
    35 
    36 /**
    37  * Stop program.
    38  */
    39 const command_t CMD_END = 0xED;
    40 
    41 /**
    42  * Increase value at given address
    43  * parameter: address_t
    44  */
    45 const command_t CMD_INCREMENT = 0x11;
    46 
    47 /**
    48  * Decrease value at given address
    49  * parameter: address_t
    50  */
    51 const command_t CMD_DECREMENT = 0x12;
    52 
    53 /**
    54  * Placeholder for unsupported command.
    55  * Just for testing.
    56  */
    57 const command_t CMD_INVALID = 0x1;
    58 
    59 // TODO: more commands, better numbers