remote.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007, IRTrans GmbH
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without 
00006  * modification, are permitted provided that the following conditions are met:
00007  *     * Redistributions of source code must retain the above copyright
00008  *       notice, this list of conditions and the following disclaimer. 
00009  *     * Redistributions in binary form must reproduce the above copyright
00010  *       notice, this list of conditions and the following disclaimer in the
00011  *       documentation and/or other materials provided with the distribution. 
00012  *     * Neither the name of IRTrans GmbH nor the
00013  *       names of its contributors may be used to endorse or promote products
00014  *       derived from this software without specific prior written permission. 
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY IRTrans GmbH ``AS IS'' AND ANY
00017  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
00019  * DISCLAIMED. IN NO EVENT SHALL IRTrans GmbH BE LIABLE FOR ANY
00020  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
00022  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
00025  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  */
00027 
00028 
00029 
00030 #ifdef WIN32
00031 typedef unsigned char uint8_t;
00032 typedef unsigned int uint32_t;
00033 typedef unsigned short uint16_t;
00034 
00035 typedef char int8_t;
00036 typedef short int16_t;
00037 typedef int int32_t;
00038 typedef unsigned int uint32_t;
00039 #endif
00040 
00041 #ifdef _HCS12
00042 
00043 typedef INT8 int8_t;
00044 typedef UINT8 uint8_t;
00045 
00046 typedef UINT16 uint16_t;
00047 typedef INT16 int16_t;
00048 
00049 typedef UINT32 uint32_t;
00050 
00051 #endif
00052 
00053 typedef uint8_t byte;
00054 typedef uint16_t word;
00055 
00056 #ifdef _HCS12
00057 #define CODE_LEN        174
00058 
00059 #else
00060 #ifndef AVR
00061 #pragma pack(1)
00062 #define CODE_LEN        176                                                     // 2 Byte mehr für String-Ende 0
00063 #else
00064 #ifdef REMOTECONTROL
00065 #define CODE_LEN        20
00066 #else
00067 #define CODE_LEN        174
00068 #endif
00069 #endif
00070 #endif
00071 
00072 
00073 #ifdef AMEX
00074 #define VCC_THRESHOLD   180
00075 #else
00076 #define VCC_THRESHOLD   210
00077 #endif
00078 
00079 #define LAN_TIMEOUT_VAL 60
00080 
00081 #define TIME_LEN        8
00082 #define RAW_EXTRA       TIME_LEN * 4 + 2
00083 #define CODE_LENRAW     (CODE_LEN + RAW_EXTRA - 2)
00084 #define OLD_LENRAW      (CODE_LEN + (6 * 4 + 2) - 2)
00085 #define MAXLCDLEN 170
00086 
00087 
00088 
00089 typedef struct {
00090         byte len;                                                       //      0
00091         byte checksumme;                                        //      1
00092         byte command;                                           //      2
00093 
00094         byte address;                                           //      3
00095         word target_mask;                                       //      4
00096 
00097         byte ir_length;                                         //      6
00098         byte transmit_freq;                                     //      7
00099         byte mode;                                                      //      8
00100 
00101         int16_t pause_len[TIME_LEN];            //      9
00102         int16_t pulse_len[TIME_LEN];            // 25
00103         byte time_cnt;                                          // 41
00104         byte ir_repeat;                                         // 42
00105         byte repeat_pause;                                      // 43
00106 
00107         byte data[CODE_LEN];                            // 44
00108 } IRDATA;
00109 
00110 
00111 #ifndef AVR
00112 
00113 typedef struct {
00114         word crc;
00115         byte errcnt;
00116         byte dummy;
00117         byte cryptstart;
00118         byte cryptend;
00119         word magic;
00120         word pagesize;
00121         word pagecnt;
00122         word data[65536];
00123 } FLASH_IR_DATA;
00124 
00125 
00126 #define IR_MAGIC                                0x7a8e
00127 
00128 #endif
00129 
00130 #define VERSION_MAGIC_1                 0x39
00131 #define VERSION_MAGIC_2                 0x640b
00132 #define VERSION_MAGIC_CHECK             0xaa
00133 #define VERSION_MAGIC_CHECKR    0x68
00134 
00135 #define FLASH_TYPE_LAN                  0xff01
00136 #define FLASH_TYPE_IRDB                 0xff02
00137 #define FLASH_TYPE_IRDBAUX              0xff03
00138 
00139 #define SENDMASK_LEN  16
00140 
00141 #define COMMAND_LAN             200
00142 #define COMMAND_FLASH_START     201
00143 #define COMMAND_FLASH_DATA      202
00144 #define COMMAND_FLASH_END               203
00145 #define COMMAND_FLASH_ACK       204
00146 #define COMMAND_FLASH_CANCEL    205
00147 #define COMMAND_FLASH_HTML      206
00148 #define COMMAND_SEND_RS232      207
00149 #define COMMAND_FLASH_ACK_1     208
00150 #define COMMAND_FLASH_ACK_2     209
00151 #define COMMAND_FLASH_CRC       210
00152 #define COMMAND_FLASH_IR        211
00153 
00154 #define COMMAND_LAN_SENDSTRING  's' 
00155 #define COMMAND_LAN_PING        'p' 
00156 #define COMMAND_LAN_SENDCCF     'c' 
00157 
00158 
00159 
00160 
00161 #define RESULT_IR_BROADCAST                 230
00162 #define RESULT_GETVERSION               231
00163 #define RESULT_DEVSTATUS                      232
00164 #define RESULT_EEPROM                           233
00165 #define RESULT_RESET                            234
00166 #define RESULT_IRDBSTATUS               235
00167 #define RESULT_REMOTELIST               236
00168 #define RESULT_COMMANDLIST                  237
00169 #define RESULT_IR_RECEIVE               238
00170 #define RESULT_UDP_FORMAT                     239
00171 #define RESULT_FLASH                            240
00172 #define RESULT_ALIVE                            241
00173 #define RESULT_LEARN                            242
00174 #define RESULT_READ_EEPROM                  243
00175 #define RESULT_WAKE_ON_LAN                  244
00176 #define RESULT_PING_OK                        245
00177 #define RESULT_IR_HOSTBROADCAST         246
00178 #define RESULT_IR_BROADCAST_LED         247
00179 #define RESULT_AUX_FORMAT               248
00180 #define RESULT_ANALOG_INPUT                     249
00181 
00182 
00183 #define ADR_LANPARM             256
00184 #define LEN_LANPARM             (sizeof (LAN_PARAMETER)-3)                      // LEN = 21
00185 #define ADR_SYSPARM             (ADR_LANPARM+LEN_LANPARM)
00186 #define LEN_SYSPARM             (sizeof (SYS_PARAMETER)-4)                      // LEN = 191 -> capabilities not stored in EEPROM 
00187 #define ADR_WAKEMAC             (ADR_LANPARM+LEN_LANPARM+164)
00188 #define ADR_TIMER               (ADR_SYSPARM+LEN_SYSPARM)
00189 #define LEN_TIMER               sizeof (TIMER_ENTRY_GET)                        // LEN = 117
00190 
00191 typedef struct {
00192   uint8_t mode;
00193   uint8_t status;
00194   uint8_t year;
00195   uint8_t month;
00196   uint8_t day;
00197   uint8_t hour;
00198   uint8_t min;
00199   uint8_t weekday;
00200   uint32_t next_time;
00201 } TIMER_ENTRY;
00202 
00203 typedef struct {
00204   uint8_t len;
00205   TIMER_ENTRY tim;
00206         uint8_t remote[81];
00207         uint8_t ircommand[21];
00208         uint8_t ledselect;
00209         uint16_t  targetmask;
00210 } TIMER_ENTRY_GET;
00211   
00212 typedef struct {
00213         uint8_t         len;
00214         uint8_t      checksumme;
00215         uint8_t      command;
00216         uint8_t      mode;
00217   TIMER_ENTRY tim;
00218         uint8_t remote[81];
00219         uint8_t ircommand[21];
00220         uint8_t ledselect;
00221         uint16_t  targetmask;
00222 } TIMER_ENTRY_STORE;
00223 
00224 typedef struct {
00225         uint8_t len;
00226         uint8_t checksumme;
00227         uint8_t command;
00228 
00229         uint8_t cmd_str[80 + 20 + 10];
00230 } IRCOMMAND_STRING;
00231 
00232 
00233 typedef struct {
00234         uint8_t len;
00235         uint8_t checksumme;
00236         uint8_t command;
00237 
00238         uint8_t remote[81];
00239         uint8_t ircommand[121];
00240         uint16_t mask;
00241         uint8_t ledselect;
00242 } IRCOMMAND_BUF;
00243 
00244 typedef struct {
00245         uint8_t len;
00246         uint8_t checksumme;
00247         uint8_t command;
00248         uint8_t dummy;
00249 
00250         uint16_t start;
00251         uint8_t remote[81];
00252 } IRDBLIST_BUF;
00253 
00254 
00255 typedef struct {
00256         word adr;
00257         word len;
00258         word flash_adr;
00259         word page;
00260         word crc;
00261 } FLASH_BLOCK;
00262 
00263 typedef struct {
00264         word crc;
00265         word type;
00266         FLASH_BLOCK dir[12];
00267 } FLASH_TABLE;
00268 
00269 #define FLASH_TABLE_LEN ((sizeof (FLASH_TABLE) + 1) / 2)
00270 
00271 typedef struct {
00272         uint8_t netcommand;
00273   word    adr;
00274   word    len;
00275   uint8_t data[512];
00276 } IRDATA_LAN_FLASH;
00277 
00278 typedef struct {
00279         uint8_t netcommand;
00280         uint8_t mode;
00281         uint16_t timeout;
00282         uint32_t sendmask[SENDMASK_LEN];
00283         IRDATA ir_data;
00284 } IRDATA_LAN;
00285 
00286 typedef struct {
00287         uint8_t netcommand;
00288         uint8_t mode;
00289         uint16_t timeout;
00290         uint32_t sendmask[SENDMASK_LEN];
00291         IRDATA ir_data;
00292         byte buffer[256];
00293 } IRDATA_LAN_LARGE;
00294 
00295 typedef struct {
00296         uint8_t netcommand;
00297         IRDATA ir_data;
00298 } IRDATA_LAN_SHORT;
00299 
00300 typedef struct {
00301         byte len;
00302         byte checksumme;
00303         byte command;
00304         word adr;
00305         byte data[200];
00306 } IRDATA_EEPROM;
00307 
00308 typedef struct {
00309         uint8_t         netcommand;
00310         uint8_t         len;
00311         uint8_t         ir_version[8];
00312         uint32_t        ir_capabilities;
00313         uint32_t        ir_serno;
00314         uint8_t         lan_version[8];
00315         uint8_t         mac_adr[6];
00316 } GETVERSION_LAN;
00317 
00318 typedef struct {
00319         uint32_t        access_ip[8];           // 0    // Erlaubte Input IPs
00320         uint32_t        access_mask[8];         // 32   // Netmask dazu
00321         uint32_t        ir_relay_from[16];      // 64   // IR Relay von diesen Adressen erlaubt
00322         uint32_t        ir_relay_to[8];         // 128  // Output wird zusätzlich zum Broadcast an diese IPs gesendet
00323         uint32_t        udp_str_adr;            // 160  
00324         uint8_t         wakeonlan_mac[6];       // 164  // Zielhost für WakeOnLAN Pakete (PowerOn)
00325         int8_t          password[12];           // 170
00326         uint8_t         broadcast_relay;        // 182
00327         uint8_t         udp_format_len;         // 183
00328         uint16_t        udp_port;                       // 184
00329         uint8_t         tz;                                     // 186
00330         uint32_t        ntp_ip;                         // 187
00331         uint32_t        ir_relay_led;           // 191
00332         uint32_t  capabilities;                 // 195
00333 } SYS_PARAMETER;
00334 
00335 typedef struct {
00336         uint8_t                 len;
00337         SYS_PARAMETER   sysparm;
00338 } SYS_PARAMETER_GET;
00339 
00340 typedef struct {
00341         uint8_t         len;
00342         byte      checksumme;
00343         byte      command;
00344         byte      mode;
00345         SYS_PARAMETER   sysparm;
00346 } SYS_PARAMETER_STORE;
00347 
00348 typedef struct {
00349         uint8_t         len;
00350         byte      checksumme;
00351         byte      command;
00352         byte      udplen;
00353         byte      str[100];
00354 } UDP_FORMAT_STORE;
00355 
00356 typedef struct {
00357         uint8_t         len;
00358         uint8_t         dhcp_flag;
00359         uint8_t         fallback_flag;
00360         uint8_t         mac_adr[6];
00361         uint32_t        ip_adr;
00362         uint32_t        ip_netmask;
00363         uint32_t        ip_gateway;
00364         uint8_t   eeprom_device_mode;
00365         uint8_t   eeprom_extended_mode;
00366         uint8_t   eeprom_extended_mode2;
00367 } LAN_PARAMETER;
00368 
00369 typedef struct {
00370         uint8_t         len;
00371         byte      checksumme;
00372         byte      command;
00373         uint8_t         dhcp_flag;
00374         uint8_t         fallback_flag;
00375         uint8_t         mac_adr[6];
00376         uint32_t        ip_adr;
00377         uint32_t        ip_netmask;
00378         uint32_t        ip_gateway;
00379 } LAN_PARAMETER_STORE;
00380 
00381 typedef struct {
00382         byte len;
00383         byte checksumme;
00384         byte command;
00385 
00386         byte address;
00387         word target_mask;
00388 
00389         byte ir_length;
00390         byte transmit_freq;
00391         byte mode;
00392 
00393         word pause_len[6];
00394         word pulse_len[6];
00395         byte time_cnt;
00396         byte ir_repeat;
00397         byte repeat_pause;
00398 
00399         byte data[CODE_LEN];
00400 } IRDATA3;
00401 
00402 typedef struct {
00403         byte len;
00404         byte checksumme;
00405         byte command;
00406 
00407         byte address;
00408         word target_mask;
00409 
00410         byte ir_length;
00411         byte transmit_freq;
00412         byte mode;
00413 
00414         byte data[CODE_LENRAW];
00415 } IRRAW;
00416 
00417 typedef struct {
00418         byte len;
00419         byte checksumme;
00420         byte command;
00421 
00422         byte address;
00423         word target_mask;
00424 
00425         byte ir_length;
00426         byte transmit_freq;
00427         byte mode;
00428 
00429         byte data[MAXLCDLEN];
00430 } IRRAWLCD;
00431 
00432 typedef struct {
00433         uint8_t len;
00434         uint8_t count_buffer;
00435         int16_t offset;
00436         int16_t count_total;
00437         int8_t remotes[3][80];
00438 } REMOTEBUFFER_INT;
00439 
00440 typedef struct {
00441         uint8_t len;
00442         uint8_t count_buffer;
00443         int16_t offset;
00444         int16_t count_total;
00445         int8_t commands[12][20];
00446 } COMMANDBUFFER_INT;
00447 
00448 typedef struct {
00449         uint32_t target_mask;
00450         uint32_t source_mask;
00451         int8_t name[80];
00452 } REMOTELINE;
00453 
00454 typedef struct {
00455         int16_t statuslen;
00456         int16_t statustype;
00457   int16_t offset;
00458   int16_t count_buffer;
00459         int16_t count_total;
00460         int16_t count_remaining;
00461         int8_t  remotes[3][80];
00462 } REMOTEBUFFER_TCP;
00463 
00464 typedef struct {
00465         int16_t statuslen;
00466         int16_t statustype;
00467   int16_t offset;
00468   int16_t count_buffer;
00469         int16_t count_total;
00470         int16_t count_remaining;
00471         REMOTELINE remotes[3];
00472 } REMOTEBUFFER_SHORT;
00473 
00474 
00475 typedef struct {
00476         int16_t statuslen;
00477         int16_t statustype;
00478   int16_t offset;
00479   int16_t count_buffer;
00480         int16_t count_total;
00481         int16_t count_remaining;
00482         int8_t commands[12][20];
00483 } COMMANDBUFFER_SHORT;
00484 
00485 typedef struct {
00486         int16_t statuslen;
00487         int16_t statustype;
00488         uint8_t data[240];
00489 } LEARNBUFFER_TCP;
00490 
00491 
00492 #define BROADCAST_UDP           1
00493 #define BROADCAST_AUX           2
00494 
00495 typedef struct {
00496         uint8_t         len;
00497         uint8_t         modeflags;
00498         uint32_t        ip;
00499         uint16_t        port;
00500         uint8_t         data[10];
00501 } UDP_ASCII_RECEIVE;
00502 
00503 typedef struct {
00504         uint8_t len;
00505         uint16_t action_adr;
00506         uint16_t remote_adr;
00507         uint32_t ip;
00508         uint16_t port;
00509         uint8_t modeflags;
00510         uint8_t remote[80];
00511         uint8_t command[20];
00512         uint8_t ircommand[141];
00513 } IRRECEIVE;
00514 
00515 typedef struct {
00516         int16_t statuslen;
00517         int16_t statustype;
00518         int16_t adress;
00519   uint16_t command_num;
00520         int8_t remote[80];
00521         int8_t command[20];
00522         int8_t data[141];
00523 } NETWORKRECV_SHORT;
00524 
00525 
00526 typedef struct {
00527         uint8_t len;
00528         uint8_t mode[8];
00529         uint8_t value[8];
00530 } ANALOG_INPUTS;
00531 
00532 typedef struct {
00533         uint8_t netcommand;
00534         ANALOG_INPUTS ai;
00535 } GET_ANALOG_INPUTS;
00536 
00537 
00538 // Mode Flags
00539 #define DEVMODE_PC                      0
00540 #define DEVMODE_SEND            1
00541 #define DEVMODE_IR                      2
00542 #define DEVMODE_SBUS            4
00543 #define DEVMODE_IGNORETOG       8
00544 #define DEVMODE_SBUSCODE        16
00545 #define DEVMODE_RAW                     32
00546 #define DEVMODE_RAWFAST         64
00547 #define DEVMODE_REPEAT          128
00548 
00549 // Extended Mode Flags
00550 #define INTERNAL_LEDS           1
00551 #define EXTERNAL_LEDS           2
00552 #define STANDARD_RCV            4
00553 #define BO_RCV                          8
00554 #define BO_MODE                         16
00555 #define SELF_REPEAT                     32
00556 #define INTERNAL_REPEAT         64
00557 #define SBUS_UART                       128                     // Set: SBUS läuft über UART
00558 
00559 #define PLASMA_RCV                      STANDARD_RCV
00560 #define BO_MASK                         (BO_RCV | BO_MODE)
00561 
00562 // Extended Mode2 Flags
00563 #define LRN_TIMEOUT_MASK        7                       // Bit 0-2
00564 #define SBUS_BAUD_MASK          24                      // Bit 3-4
00565 #define RS232_BAUD_MASK         96                      // Bit 5-6      
00566 #define RS232_RTS_CTS           128                     // Bit 7                
00567 
00568 
00569 #define LOCAL_MODE                      16
00570 #define RECEIVE_ALL                     17
00571 #define QUICK_MODE                      32
00572 #define RAW_MODE                        64
00573 #define REPEAT_MODE                     128
00574 #define IR_MODE                         256
00575 #define SBUS_MODE                       512
00576 #define INSTANT_MODE            1024
00577 #define IDLE_WAIT                       2048
00578 
00579 #define LONG_LEARN_MODE                 16
00580 #define RECEIVER_SELECT_MASK    96
00581 #define RECEIVER_SELECT_38              32
00582 #define RECEIVER_SELECT_455             64
00583 
00584 
00585 #define LONG_CODE_FLAG          128
00586 #define LONG_CODE_LEN           8
00587 #define USE_LONG_CODES          1
00588 #define LONG_CODE_MODE_CAL      2
00589 
00590 // Bereiche der Command Codes durch LEARN blockiert:
00591 //
00592 //  16 -  31
00593 //  48 -  63
00594 //      80 -  95
00595 // 112 - 128
00596 // 144 - 159
00597 // 176 - 191
00598 // 208 - 223
00599 // 240 - 255
00600 
00601 
00602 
00603 // Hier LEARN Command Codes
00604 #define SBUS_LEARN                      16
00605 #define HOST_LEARNIR            18
00606 #define SBUS_QUICKPARM          48
00607 #define HOST_LEARNIRQUICK       50
00608 #define SBUS_RAWMODE            80
00609 #define HOST_LEARNIRRAW         82
00610 #define SBUS_REPEATMODE         144
00611 #define HOST_LEARNIRREPEAT      146
00612 #define SBUS_RAWREPEATMODE              208
00613 #define HOST_LEARNIRRAWREPEAT   210
00614 
00615 
00616 // Hier Standard Command Codes
00617 #define SBUS_REPEAT                     1
00618 #define HOST_VERSION            2
00619 #define HOST_NETWORK_STATUS     3
00620 #define SBUS_SEND                       4
00621 #define SBUS_RESEND                     5
00622 #define HOST_SEND                       6
00623 #define HOST_RESEND                     7
00624 
00625 #define LAN_REPEAT                      32
00626 #define PUT_SERIAL_DATA         33
00627 #define READ_ANALOG_INPUTS      34
00628 
00629 #define ASCII_SEND                      100 // 'd'
00630 
00631 #define SBUS_RESET                      192
00632 #define SBUS_PING                       193
00633 #define SBUS_PONG                       194
00634 #define SBUS_PARAMETER          196
00635 #define HOST_SETMODE            197
00636 #define SET_ID                          199
00637 #define SET_TRANSLATE_DATA      200
00638 #define SBUS_TRANSLATE_DATA     201
00639 #define READ_TRANSLATE_DATA     202
00640 #define START_FLASH_MODE        203
00641 #define TRANSFER_FLASH          204
00642 #define SBUS_SET_MODE2          206
00643 #define HOST_SET_MODE2          207
00644 
00645 #define HOST_STORE_LANPARM      224
00646 #define HOST_READ_LANPARM       225
00647 #define HOST_STORE_FLASH        226
00648 #define HOST_READ_FLASH         227
00649 #define SEND_IRDB_STRING        228
00650 #define SEND_IRDB_BLOCK         229
00651 #define RESEND_IRDB_BLOCK       230
00652 #define IRDB_REMLIST            231
00653 #define IRDB_COMLIST            232
00654 //#define HOST_STORE_UDPSTR     233
00655 #define PING_IR_CONTROLLER      234
00656 #define SET_POWER_LED           235
00657 #define TEST_IRDB_BLOCK         236
00658 #define GET_TIMER_PARAMETER 237
00659 #define STORE_TIMER_PARAMETER 238
00660 
00661 
00662 #define SEND                            SBUS_SEND
00663 #define LEARN                           SBUS_LEARN
00664 #define SETMODE                         SBUS_PARAMETER
00665 
00666 #define ADRESS_MASK                     15
00667 #define ADRESS_LOCAL            16
00668 #define ADRESS_ALL                      32
00669 #define ADRESS_LAN                      64
00670 
00671 
00672 #define START_BIT                       1
00673 #define REPEAT_START            2
00674 #define START_MASK                      3
00675 #define RC5_DATA                        4
00676 #define RC6_DATA                        8
00677 #define IRDA_DATA                       12
00678 #define RAW_DATA                        16
00679 #define NO_TOGGLE                       2
00680 #define NO_TOGGLE_H                     64
00681 #define MACRO_DATA                      32
00682 
00683 
00684 #define LCD_BACKLIGHT           1
00685 #define LCD_TEXT                        2
00686 
00687 
00688 #define LCD_INIT                        4
00689 #define LCD_SETTIME                     8
00690 #define LCD_DISPLAYTIME         16
00691 #define LCD_DEFINECHAR          12
00692 #define LCD_BRIGHTNESS          20
00693 #define LCD_REFRESHDATE         24
00694 
00695 #define LCD_DATA                        32
00696 
00697 #define TEMP_GET                        1
00698 #define TEMP_RESET                      2
00699 #define TEMP_DATA                       64
00700 #define NON_IRMODE                      224
00701 
00702 #define SWITCH_DATA                     96
00703 
00704 #define SHORT_PULSE                     50
00705 #define IR_CORRECT_455          1                               // Entspricht 8 µs Korrektur
00706 
00707 #ifndef IR_CORRECT
00708 #define IR_CORRECT                      8                               // Entspricht 64 µs Korrektur
00709 #define IR_CORRECT_LOW          4                               // Entspricht 24 µs Korrektur für kurze Pulse
00710 #else
00711 #define IR_CORRECT_LOW          0                               // Entspricht 24 µs Korrektur für kurze Pulse
00712 #endif
00713 
00714 
00715 #define IR_TOLERANCE_BO         50                              // Entspricht 280 µs Toleranz
00716 #define IR_TOLERANCE            15                              // Entspricht 120 µs Toleranz
00717 #define RCX_TOLERANCE           19                              // Entspricht 152 µs Toleranz
00718 #define MAX_IR_REPEAT           5
00719 #define RAW_TOLERANCE           20
00720 
00721 #define EXT_LED_SELECT_1        4
00722 #define EXT_LED_SELECT_2        8
00723 #define EXT_LED_SELECT_3        12
00724 #define EXT_LED_SELECT_4        16
00725 #define EXT_LED_SELECT_5        20
00726 #define EXT_LED_SELECT_6        24
00727 #define EXT_LED_SELECT_7        28
00728 #define EXT_LED_SELECT_8        32
00729 
00730 #define EXT_LED_SELECT_MASK     60
00731 
00732 
00733 
00734 #ifndef AVR
00735 
00736 #define FN_IR                   1
00737 #define FN_SBUS                 2
00738 #define FN_SER                  4
00739 #define FN_USB                  8
00740 #define FN_POWERON              16
00741 #define FN_B_O                  32
00742 #define FN_CALIBRATE    64
00743 #define FN_SOFTID               128
00744 #define FN_EEPROM               256
00745 #define FN_TRANSL               512
00746 #define FN_HWCARR               1024
00747 #define FN_DUALRCV              2048
00748 #define FN_SBUS_UART    4096
00749 #define FN_FLASH128             8192
00750 #define FN_DUALSND              16384
00751 #define FN_DISP1                32768
00752 #define FN_DISP2                0x10000
00753 #define FN_DISP3                0x20000
00754 #define FN_CLOCK                0x40000
00755 #define FN_DEBOUNCE             0x80000
00756 #define FN_BOOTLOADER   0x100000
00757 #define FN_DUALPOWERON  0x200000
00758 #define FN_USBWAKEUP    0x400000
00759 #define FN_NOSCROLL             0x800000
00760 #define FN_LAN                  0x1000000
00761 #define FN_IRDB                 0x2000000
00762 #define FN_LARGECPU             0x4000000
00763 #define FN_MULTIRELAY4  0x8000000
00764 #define FN_MULTISEND4   0x10000000
00765 #define FN_MULTISEND8   0x20000000
00766 #define FN_MULTISEND2   0x40000000
00767 #define FN_HTML                 0x80000000
00768 
00769 
00770 #define FUNCTION_FLASH_MASK  ~(FN_SBUS_UART | FN_CLOCK | FN_DEBOUNCE | FN_DUALPOWERON | FN_USBWAKEUP | FN_NOSCROLL | FN_TRANSL | FN_CALIBRATE | FN_POWERON)
00771 
00772 #endif
00773 
00774 #define START                   1
00775 #define REPEAT                  2
00776 
00777 
00778 typedef struct {
00779         byte sbus_len;
00780         byte sbus_checksumme;
00781         byte sbus_command;
00782         byte sbus_address;
00783         byte mode;
00784         word target_mask;
00785         byte hotcode_len;
00786         byte hotcode[CODE_LENRAW];
00787 } MODE_BUFFER;
00788 
00789 typedef struct {
00790         byte sbus_len;
00791         byte sbus_checksumme;
00792         byte sbus_command;
00793         byte sbus_address;
00794         byte mode;
00795         word target_mask;
00796         byte hotcode_len;
00797         byte extmode1;
00798         byte extmode2;
00799         char remote[81];
00800         char command[21];
00801 } MODE_BUFFER_LAN;
00802 
00803 
00804 typedef struct {
00805         byte sbus_len;
00806         byte sbus_checksumme;
00807         byte sbus_command;
00808         byte sbus_address;
00809         byte device_mode;
00810         word send_mask;
00811         byte version[10];
00812         byte extended_mode;
00813         uint32_t capabilities;
00814         byte extended_mode2;
00815         byte extended_mode3;
00816         byte extended_mode4;
00817         byte wake_mac[6];
00818         char remote[81];
00819         char command[21];
00820 } STATUS_LINE_EX;
00821 
00822 typedef struct {
00823         byte sbus_len;
00824         byte sbus_checksumme;
00825         byte sbus_command;
00826         byte sbus_address;
00827         byte device_mode;
00828         word send_mask;
00829         byte version[10];
00830         byte extended_mode;
00831         uint32_t capabilities;
00832         byte extended_mode2;
00833         byte extended_mode3;
00834         byte extended_mode4;
00835         byte wake_mac[6];
00836 } STATUS_LINE;
00837 
00838 typedef struct {
00839         byte sbus_len;
00840         byte sbus_checksumme;
00841         byte sbus_command;
00842         byte sbus_address;
00843         byte device_mode;
00844         word send_mask;
00845         byte version[10];
00846         byte extended_mode;
00847         uint32_t capabilities;
00848         byte extended_mode2;
00849 } STATUS_LINE_4;
00850 
00851 typedef struct {
00852         byte sbus_len;
00853         byte sbus_checksumme;
00854         byte sbus_command;
00855         byte sbus_address;
00856         byte device_mode;
00857         word send_mask;
00858         byte version[10];
00859         byte extended_mode;
00860         word capabilities;
00861 } STATUS_LINE_3;
00862 
00863 typedef struct {
00864         byte sbus_len;
00865         byte sbus_checksumme;
00866         byte sbus_command;
00867         byte sbus_address;
00868         byte device_mode;
00869         word send_mask;
00870         byte version[10];
00871         byte extended_mode;
00872 } STATUS_LINE_2;
00873 
00874 typedef struct {
00875         byte sbus_len;
00876         byte sbus_checksumme;
00877         byte sbus_command;
00878         byte sbus_address;
00879         byte device_mode;
00880         word send_mask;
00881         byte version[10];
00882 } STATUS_LINE_1;
00883 
00884 typedef struct {
00885         byte my_adress;
00886         STATUS_LINE stat[16];
00887 } STATUS_BUFFER;
00888 
00889 typedef struct {
00890         byte my_adress;
00891         STATUS_LINE_1 stat[16];
00892 } STATUS_BUFFER_1;
00893 
00894 typedef struct {
00895         byte my_adress;
00896         STATUS_LINE_2 stat[16];
00897 } STATUS_BUFFER_2;
00898 
00899 typedef struct {
00900         byte my_adress;
00901         STATUS_LINE_3 stat[16];
00902 } STATUS_BUFFER_3;
00903 
00904 typedef struct {
00905         byte my_adress;
00906         STATUS_LINE_4 stat[16];
00907 } STATUS_BUFFER_4;
00908 
00909 typedef struct {
00910         uint8_t netcommand;
00911         STATUS_LINE_EX stat;
00912 } STATUS_LINE_LAN;
00913 
00914 #define LOGIN_NEEDED      128
00915 #define DYNAMIC_LEN       64
00916 #define EXTERNAL_FILE     32
00917 #define RQ_DATA_CURRENT   16
00918 #define MENU_NEEDED       8
00919 
00920 #define CONTENT_MASK      7
00921 
00922 #define CONTENT_HTML      1
00923 #define CONTENT_PLAIN     2
00924 #define CONTENT_GIF       3
00925 #define CONTENT_JPEG      4
00926 
00927 
00928 typedef struct {
00929   char  name[23];
00930   byte  filetype;
00931   word  adr;
00932   word  len;
00933   uint32_t timestamp;
00934 } HTTP_DIRENTRY;
00935 
00936 typedef struct {
00937   word  count;
00938   word  magic;
00939   HTTP_DIRENTRY dir[1];
00940 } HTTP_DIRECTORY;
00941 
00942 #define IRTRANS_PORT    21000
00943 


ir_drivers
Author(s): Raul Perula-Martinez
autogenerated on Thu Apr 2 2015 03:06:05