]>
Commit | Line | Data |
---|---|---|
1 | /* vim:ts=4 sts=4 et tw=80 | |
2 | * | |
3 | * fnordlicht firmware | |
4 | * | |
5 | * for additional information please | |
6 | * see http://lochraster.org/fnordlichtmini | |
7 | * | |
8 | * (c) by Alexander Neumann <alexander@bumpern.de> | |
9 | * | |
10 | * This program is free software: you can redistribute it and/or modify it | |
11 | * under the terms of the GNU General Public License version 3 as published by | |
12 | * the Free Software Foundation. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
17 | * more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License along with | |
20 | * this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | */ | |
22 | ||
23 | #ifndef __REMOTE_PROTO_COMMON | |
24 | #define __REMOTE_PROTO_COMMON 1 | |
25 | ||
26 | #define REMOTE_MSG_LEN 15 | |
27 | #define REMOTE_SYNC_LEN 15 | |
28 | ||
29 | /* normal commands */ | |
30 | #define REMOTE_CMD_FADE_RGB 0x01 | |
31 | #define REMOTE_CMD_FADE_HSV 0x02 | |
32 | #define REMOTE_CMD_SAVE_RGB 0x03 | |
33 | #define REMOTE_CMD_SAVE_HSV 0x04 | |
34 | #define REMOTE_CMD_SAVE_CURRENT 0x05 | |
35 | #define REMOTE_CMD_CONFIG_OFFSETS 0x06 | |
36 | #define REMOTE_CMD_START_PROGRAM 0x07 | |
37 | #define REMOTE_CMD_STOP 0x08 | |
38 | #define REMOTE_CMD_MODIFY_CURRENT 0x09 | |
39 | #define REMOTE_CMD_PULL_INT 0x0A | |
40 | #define REMOTE_CMD_CONFIG_STARTUP 0x0B | |
41 | #define REMOTE_CMD_POWERDOWN 0x0C | |
42 | ||
43 | #define REMOTE_CMD_RESYNC 0x1b | |
44 | ||
45 | /* max mode for startup configuration is 1 */ | |
46 | #define REMOTE_STARTUP_MAX_MODE 1 | |
47 | /* maximum parameter size (for copy loop), size of structure storage_config_t, | |
48 | * minus 1 for startup_mode enum */ | |
49 | #define REMOTE_STARTUP_MAX_PARAMSIZE 11 | |
50 | ||
51 | /* bootloader commands */ | |
52 | #define REMOTE_CMD_BOOTLOADER 0x80 | |
53 | #define REMOTE_CMD_BOOT_CONFIG 0x81 | |
54 | #define REMOTE_CMD_BOOT_INIT 0x82 | |
55 | #define REMOTE_CMD_BOOT_DATA 0x83 | |
56 | #define REMOTE_CMD_CRC_CHECK 0x84 | |
57 | #define REMOTE_CMD_CRC_FLASH 0x85 | |
58 | #define REMOTE_CMD_FLASH 0x86 | |
59 | #define REMOTE_CMD_ENTER_APP 0x87 | |
60 | ||
61 | #define REMOTE_ADDR_BROADCAST 0xff | |
62 | ||
63 | /* normal commands */ | |
64 | struct remote_msg_t | |
65 | { | |
66 | uint8_t address; | |
67 | uint8_t cmd; | |
68 | uint8_t data[REMOTE_MSG_LEN-2]; | |
69 | }; | |
70 | ||
71 | /* bootloader commands */ | |
72 | #define BOOTLOADER_MAGIC_BYTE1 0x6b | |
73 | #define BOOTLOADER_MAGIC_BYTE2 0x56 | |
74 | #define BOOTLOADER_MAGIC_BYTE3 0x27 | |
75 | #define BOOTLOADER_MAGIC_BYTE4 0xfc | |
76 | struct remote_msg_bootloader_t | |
77 | { | |
78 | uint8_t address; | |
79 | uint8_t cmd; | |
80 | uint8_t magic[4]; | |
81 | }; | |
82 | ||
83 | struct remote_msg_boot_config_t | |
84 | { | |
85 | uint8_t address; | |
86 | uint8_t cmd; | |
87 | uint16_t start_address; | |
88 | uint8_t buffersize; | |
89 | }; | |
90 | ||
91 | struct remote_msg_boot_data_t | |
92 | { | |
93 | uint8_t address; | |
94 | uint8_t cmd; | |
95 | uint8_t data[REMOTE_MSG_LEN-2]; | |
96 | }; | |
97 | ||
98 | struct remote_msg_boot_crc_check_t | |
99 | { | |
100 | uint8_t address; | |
101 | uint8_t cmd; | |
102 | uint16_t len; | |
103 | uint16_t checksum; | |
104 | uint8_t delay; | |
105 | }; | |
106 | ||
107 | struct remote_msg_boot_crc_flash_t | |
108 | { | |
109 | uint8_t address; | |
110 | uint8_t cmd; | |
111 | uint16_t start; | |
112 | uint16_t len; | |
113 | uint16_t checksum; | |
114 | uint8_t delay; | |
115 | }; | |
116 | ||
117 | #endif |