c++/rgb-assembler/commands.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 24 Dec 2017 00:30:54 +0100
changeset 29 10d6964e7b4a
parent 28 2b2f8a17d63a
permissions -rw-r--r--
license: GNU GPLv3+
     1 /**
     2  * RGB assembler
     3  * Copyright © 2017 František Kučera (frantovo.cz)
     4  *
     5  * This program is free software: you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation, either version 3 of the License, or
     8  * (at your option) any later version.
     9  *
    10  * This program is distributed in the hope that it will be useful,
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13  * GNU General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    18 
    19 #pragma once
    20 
    21 // Standard commands
    22 
    23 /**
    24  * Skip to the given address.
    25  * parameter: address_t
    26  */
    27 const command_t CMD_GOTO = 0x70;
    28 
    29 /**
    30  * Compare values on two addresses and go to one of given three addresses.
    31  * parameter: address_t a
    32  * parameter: address_t b
    33  * parameter: address_t GOTO target when a == b
    34  * parameter: address_t GOTO target when a > b
    35  * parameter: address_t GOTO target when a < b
    36  */
    37 const command_t CMD_GOTO_COMPARE = 0x80;
    38 
    39 /**
    40  * Wait given time in ms.
    41  * parameter: sleep_t
    42  */
    43 const command_t CMD_SLEEP = 0xFF;
    44 
    45 /**
    46  * Set RGB LED color.
    47  * parameter: led_t LED number
    48  * parameter: color_t red
    49  * parameter: color_t green
    50  * parameter: color_t blue
    51  */
    52 const command_t CMD_COLOR = 0xAA;
    53 
    54 /**
    55  * Stop program.
    56  */
    57 const command_t CMD_END = 0xED;
    58 
    59 /**
    60  * Increase value at given address
    61  * parameter: address_t
    62  */
    63 const command_t CMD_INCREMENT = 0x11;
    64 
    65 /**
    66  * Decrease value at given address
    67  * parameter: address_t
    68  */
    69 const command_t CMD_DECREMENT = 0x12;
    70 
    71 /**
    72  * Placeholder for unsupported command.
    73  * Just for testing.
    74  */
    75 const command_t CMD_INVALID = 0x1;
    76 
    77 // TODO: more commands, better numbers