1 #ifndef BR_TRANSLATE_H
2 #define BR_TRANSLATE_H
3 
4 /*
5 
6 Translation tables for encoding addresses/commands for the X10 FireCracker
7   home automation kit
8 
9 (c) 1999 Tymm Twillman (tymm@acm.org).  Free Software.  LGPL applies.
10   No warranties expressed or implied.
11 
12 */
13 
14 
15 /*
16  * (for error checking)
17  */
18 
19 #define MAX_CMD     7
20 #define MAX_housecode  15
21 #define MAX_DEVICE 15
22 /*
23  * Used to create letter housecode part of a device address -- could use some
24  *  bit magic but this is less of a pain and easier to read
25  */
26 
27 static char housecode_table[] = {
28   /* A */ 0x06, /* B */ 0x07, /* C */ 0x04, /* D */ 0x05,
29   /* E */ 0x08, /* F */ 0x09, /* G */ 0x0a, /* H */ 0x0b,
30   /* I */ 0x0e, /* J */ 0x0f, /* K */ 0x0c, /* L */ 0x0d,
31   /* M */ 0x00, /* N */ 0x01, /* O */ 0x02, /* P */ 0x03
32 };
33 
34 /*
35  * For number part of device address
36  */
37 
38 static char device_table[][2] = {
39 	/*   1-4 */ {0x00, 0x00}, {0x00, 0x10}, {0x00, 0x08}, {0x00, 0x18},
40 	/*   5-8 */ {0x00, 0x40}, {0x00, 0x50}, {0x00, 0x48}, {0x00, 0x58},
41 	/*  9-12 */ {0x04, 0x00}, {0x04, 0x10}, {0x04, 0x08}, {0x04, 0x18},
42 	/* 13-16 */ {0x04, 0x40}, {0x04, 0x50}, {0x04, 0x48}, {0x04, 0x58}
43 };
44 
45 /*
46  * For encoding the command
47  */
48 
49 static char cmd_table[] = {
50     /* off */       0x00, /* on */       0x20,
51     /* dim */       0x98, /* bright */   0x88,
52     /* all off */   0x80, /* all on */   0x91,
53     /* lamps off */ 0x84, /* lamps on */ 0x94
54 };
55 
56 #endif
57 
58