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