52 */ |
52 */ |
53 /* Should not be modified */ |
53 /* Should not be modified */ |
54 #define REQUEST 1 |
54 #define REQUEST 1 |
55 #define NOT_A_REQUEST 0 |
55 #define NOT_A_REQUEST 0 |
56 |
56 |
57 /// Misc constants |
57 /* Misc constants */ |
58 // -------------- |
58 /* -------------- */ |
59 /* Should not be modified */ |
59 /* Should not be modified */ |
60 #define Rx 0 |
60 #define Rx 0 |
61 #define Tx 1 |
61 #define Tx 1 |
62 #define TRUE 1 |
62 #define TRUE 1 |
63 #define FALSE 0 |
63 #define FALSE 0 |
64 |
64 |
65 //TODO: remove this limitation. do bit granularity mapping |
65 /* TODO: remove this limitation. do bit granularity mapping */ |
66 #define PDO_MAX_LEN 8 |
66 #define PDO_MAX_LEN 8 |
67 |
67 |
68 /** Status of the SDO transmission |
68 /** Status of the SDO transmission |
69 */ |
69 */ |
70 #define SDO_RESET 0x0 // Transmission not started. Init state. |
70 #define SDO_RESET 0x0 /* Transmission not started. Init state. */ |
71 #define SDO_FINISHED 0x1 // data are available |
71 #define SDO_FINISHED 0x1 /* data are available */ |
72 #define SDO_ABORTED_RCV 0x80 // Received an abort message. Data not available |
72 #define SDO_ABORTED_RCV 0x80 /* Received an abort message. Data not available */ |
73 #define SDO_ABORTED_INTERNAL 0x85 // Aborted but not because of an abort message. |
73 #define SDO_ABORTED_INTERNAL 0x85 /* Aborted but not because of an abort message. */ |
74 #define SDO_DOWNLOAD_IN_PROGRESS 0x2 |
74 #define SDO_DOWNLOAD_IN_PROGRESS 0x2 |
75 #define SDO_UPLOAD_IN_PROGRESS 0x3 |
75 #define SDO_UPLOAD_IN_PROGRESS 0x3 |
76 |
76 |
77 // Status of the node during the SDO transfert : |
77 /* Status of the node during the SDO transfert : */ |
78 #define SDO_SERVER 0x1 |
78 #define SDO_SERVER 0x1 |
79 #define SDO_CLIENT 0x2 |
79 #define SDO_CLIENT 0x2 |
80 #define SDO_UNKNOWN 0x3 |
80 #define SDO_UNKNOWN 0x3 |
81 |
81 |
82 /* Function Codes |
82 /* Function Codes |
83 --------------- |
83 --------------- |
84 defined in the canopen DS301 |
84 defined in the canopen DS301 |
85 */ |
85 */ |
86 #define NMT 0x0 |
86 #define NMT 0x0 |
87 #define SYNC 0x1 |
87 #define SYNC 0x1 |
88 #define TIME_STAMP 0x2 |
88 #define TIME_STAMP 0x2 |
96 #define PDO4rx 0xA |
96 #define PDO4rx 0xA |
97 #define SDOtx 0xB |
97 #define SDOtx 0xB |
98 #define SDOrx 0xC |
98 #define SDOrx 0xC |
99 #define NODE_GUARD 0xE |
99 #define NODE_GUARD 0xE |
100 |
100 |
101 /// NMT Command Specifier, sent by master to change a slave state |
101 /* NMT Command Specifier, sent by master to change a slave state */ |
102 // ------------------------------------------------------------- |
102 /* ------------------------------------------------------------- */ |
103 /* Should not be modified */ |
103 /* Should not be modified */ |
104 #define NMT_Start_Node 0x01 |
104 #define NMT_Start_Node 0x01 |
105 #define NMT_Stop_Node 0x02 |
105 #define NMT_Stop_Node 0x02 |
106 #define NMT_Enter_PreOperational 0x80 |
106 #define NMT_Enter_PreOperational 0x80 |
107 #define NMT_Reset_Node 0x81 |
107 #define NMT_Reset_Node 0x81 |
108 #define NMT_Reset_Comunication 0x82 |
108 #define NMT_Reset_Comunication 0x82 |
109 |
109 |
110 /// constantes used in the different state machines |
110 /* constantes used in the different state machines */ |
111 // ----------------------------------------------- |
111 /* ----------------------------------------------- */ |
112 /* Must not be modified */ |
112 /* Must not be modified */ |
113 #define state1 0x01 |
113 #define state1 0x01 |
114 #define state2 0x02 |
114 #define state2 0x02 |
115 #define state3 0x03 |
115 #define state3 0x03 |
116 #define state4 0x04 |
116 #define state4 0x04 |