Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
196 eqlazer 1
/****************************************************************
165 eqlazer 2
 *
3
 *   Defines functs and funccs and other global definitions.
4
 *
5
 *********************************************************************
6
 *
7
 *
8
 * By: johboh, edited by eqlazer
9
 *
10
 ********************************************************************/
11
 
12
 
13
 
14
//<FUNCT>
15
#define FUNCT_BOOTLOADER 0x00
16
#define FUNCT_SENSORS 0x01
17
 
18
//<FUNCC> configuration packet
19
#define FUNCC_BOOT_INIT   0b0000000001 //Start programmring and/or resseting user program to go into bootloader mode.
20
#define FUNCC_BOOT_ADDR   0b0000000010  //Change programming address.
21
#define FUNCC_BOOT_SET_ID 0b0000000110  //Change ID and NID.
22
#define FUNCC_BOOT_DONE   0b0000000101  //End programming, start user program.
23
 
24
#define FUNCC_BOOT_HEARTBEAT 0b0000001000 // Heartbeat
25
 
26
//<FUNCC> program packet
27
#define FUNCC_BOOT_PGM 0b0000000011 //To indicate programming data packet.
28
 
29
//<FUNCC> ack packet 10 bits, 0x3FF
30
#define FUNCC_BOOT_ACK 0b0000000100 //Ack packet
31
 
32
 
33
//<FUNCC> 10 bits, 0x3FF
34
 
35
/*#define FUNCC_SENSORS_IR                      0x001
36
 
37
#define FUNCC_SENSORS_TEMPERATURE_INSIDE        0x010
38
#define FUNCC_SENSORS_TEMPERATURE_OUTSIDE       0x011
39
#define FUNCC_SENSORS_TEMPERATURE_FREEZER       0x012
40
#define FUNCC_SENSORS_TEMPERATURE_REFRIGERATOR  0x013
41
 
42
#define FUNCC_SENSORS_DOORS_FREEZER             0x020
43
#define FUNCC_SENSORS_DOORS_REFRIGERATOR        0x021
44
*/
45
 
46
#define DEFAULT_ID 0x78     // Default ID for bootloader/node when no id is set.
47
#define DEFAULT_NID 0x00    // Default ID for bootloader/node when no nid is set.
48
 
49
 
50
#define NODE_ID_EE  0x00    // EEPROM first index where to look for ID and NID. 
51
                // NODE_ID_EE = NODE_HAS_ID if has correct ID, otherwise use DEFAULT_ID and DEFAULT_NID
52
                // NODE_ID_EE + 1 = ID[1]
53
                // NODE_ID_EE + 2 = ID[0]
54
                // NODE_ID_EE + 3 = NID
55
 
56
#define NODE_HAS_ID 0x2A    // Value which indicate valid ID and NID.
57
 
58
 
59
// Definitions for BOOT packets. Which index in data where things are.
60
#define BOOT_DATA_ADDRL_INDEX 0
61
#define BOOT_DATA_ADDRH_INDEX 1
62
#define BOOT_DATA_ADDRU_INDEX 2
63
#define BOOT_DATA_RID_LOW_INDEX 4
64
#define BOOT_DATA_RID_HIGH_INDEX 5
65
#define BOOT_DATA_ERR_INDEX 4
66
#define BOOT_DATA_NEW_ID_LOW_INDEX 0 
67
#define BOOT_DATA_NEW_ID_HIGH_INDEX 1 
68
#define BOOT_DATA_NEW_NID_INDEX 2
69
#define BOOT_DATA_HEARTBEAT_INDEX 0
70
 
71
//<ERR>
72
// Value in BOOT_DATA_ERR_INDEX
73
#define ACK_ERR_NO_ERROR 0x00 //= no error
74
#define ACK_ERR_ERROR 0x01 //= error
75
 
76
//<HEART>
77
#define HEARTBEAT_BOOT_STARTUP 0x00
78
#define HEARTBEAT_USER_STARTUP 0x01
79
#define HEARTBEAT_ALIVE 0x02
80
 
81