|
121 | 121 | }, \ |
122 | 122 | { \ |
123 | 123 | /* SDO Server Request COBID */ \ |
124 | | - .Key = CO_KEY(0x1200, 0x01, CO_OBJ__N__R_), \ |
| 124 | + .Key = CO_KEY(0x1200, 0x01, CO_OBJ_DN__R_), \ |
125 | 125 | .Type = CO_TUNSIGNED32, \ |
126 | 126 | .Data = (CO_DATA) CO_COBID_SDO_REQUEST(), \ |
127 | 127 | }, \ |
128 | 128 | { /* SDO Server Response COBID */ \ |
129 | | - .Key = CO_KEY(0x1200, 0x02, CO_OBJ__N__R_), \ |
| 129 | + .Key = CO_KEY(0x1200, 0x02, CO_OBJ_DN__R_), \ |
130 | 130 | .Type = CO_TUNSIGNED32, \ |
131 | 131 | .Data = (CO_DATA) CO_COBID_SDO_RESPONSE(), \ |
132 | 132 | } |
|
199 | 199 | { \ |
200 | 200 | .Key = CO_KEY(0x1600 + RPDO_NUMBER, SUB_INDEX, CO_OBJ_D___R_), \ |
201 | 201 | .Type = CO_TUNSIGNED32, \ |
202 | | - .Data = (CO_DATA) CO_LINK(0x2100 + RPDO_NUMBER, 0x00 + SUB_INDEX, DATA_SIZE), \ |
| 202 | + .Data = (CO_DATA) CO_LINK(0x2200 + RPDO_NUMBER, 0x00 + SUB_INDEX, DATA_SIZE), \ |
203 | 203 | } |
204 | 204 |
|
205 | 205 | /** |
|
288 | 288 | * on the PDO number that it is associated with, this macro takes the PDO number associated with the |
289 | 289 | * data that will be linked. |
290 | 290 | * |
291 | | - * @param PDO_NUMBER (integer) the PDO number that this data link section is associated with. |
| 291 | + * @param LINK_NUMBER (integer) the link number that this data link section is associated with. |
292 | 292 | * @param NUMBER_OF_SUB_INDICES (integer) the number of links that this section will include. |
293 | 293 | */ |
294 | | -#define DATA_LINK_START_KEY_21XX(PDO_NUMBER, NUMBER_OF_SUB_INDICES) \ |
| 294 | +#define DATA_LINK_START_KEY_21XX(LINK_NUMBER, NUMBER_OF_SUB_INDICES) \ |
295 | 295 | { \ |
296 | | - .Key = CO_KEY(0x2100 + PDO_NUMBER, 0, CO_OBJ_D___R_), \ |
| 296 | + .Key = CO_KEY(0x2100 + LINK_NUMBER, 0, CO_OBJ_D___R_), \ |
297 | 297 | .Type = CO_TUNSIGNED8, \ |
298 | 298 | .Data = (CO_DATA) NUMBER_OF_SUB_INDICES, \ |
299 | 299 | } |
|
305 | 305 | * to allow for both TPDOs and RPDOs of any number to be linked as well as any data type and |
306 | 306 | * any data pointers. |
307 | 307 | * |
308 | | - * @param PDO_NUMBER (integer) the PDO number that this data link is associated with |
| 308 | + * @param LINK_NUMBER (integer) the link number that this data link is associated with |
309 | 309 | * @param SUB_INDEX (integer) the sub index in the great Data Link section. |
310 | 310 | * @param DATA_TYPE (CO_T...) type of the data that is being linked too. You should use the CANOpen definitions for |
311 | 311 | * types here. |
312 | 312 | * @param DATA_POINTER (pointer) a pointer to a piece of data that this data link will connect to. Please provide this |
313 | 313 | * as a pointer using the &variableName syntax. This macro does not automatically add the & |
314 | 314 | */ |
315 | | -#define DATA_LINK_21XX(PDO_NUMBER, SUB_INDEX, DATA_TYPE, DATA_POINTER) \ |
| 315 | +#define DATA_LINK_21XX(LINK_NUMBER, SUB_INDEX, DATA_TYPE, DATA_POINTER) \ |
316 | 316 | { \ |
317 | | - .Key = CO_KEY(0x2100 + PDO_NUMBER, SUB_INDEX, CO_OBJ____PRW), \ |
| 317 | + .Key = CO_KEY(0x2100 + LINK_NUMBER, SUB_INDEX, CO_OBJ____PRW), \ |
318 | 318 | .Type = DATA_TYPE, \ |
319 | 319 | .Data = (CO_DATA) DATA_POINTER, \ |
320 | 320 | } |
| 321 | + |
| 322 | +/** |
| 323 | + * This macro converts a TPDO number to the corresponding Link number. |
| 324 | + * |
| 325 | + * @param PDO_NUMBER (integer) the PDO number for the data link |
| 326 | + */ |
| 327 | +#define TPDO_NUMBER(PDO_NUMBER) (PDO_NUMBER) |
| 328 | + |
| 329 | +/** |
| 330 | + * This macro converts a RPDO number to the corresponding Link number. |
| 331 | + * |
| 332 | + * @param PDO_NUMBER (integer) the PDO number for the data link |
| 333 | + */ |
| 334 | +#define RPDO_NUMBER(PDO_NUMBER) (PDO_NUMBER + 0x100) |
| 335 | + |
321 | 336 | // clang-format on |
322 | 337 |
|
323 | 338 | #endif // EVT_CANOPENMACROS_HPP |
0 commit comments