@@ -192,7 +192,7 @@ THD_FUNCTION(pdo_sync, arg)
192
192
193
193
/* Register the callback function to wake up thread when message received */
194
194
CO_SYNC_initCallbackPre (co -> SYNC , chThdGetSelfX (), process_cb );
195
- #ifdef OD_CNT_RPDO
195
+ #if OD_CNT_RPDO > 0
196
196
for (int i = 0 ; i < OD_CNT_RPDO ; i ++ ) {
197
197
CO_RPDO_initCallbackPre (& co -> RPDO [i ], chThdGetSelfX (), process_cb );
198
198
}
@@ -203,18 +203,24 @@ THD_FUNCTION(pdo_sync, arg)
203
203
uint32_t timeout = ((typeof (timeout ))- 1 );
204
204
bool_t syncWas ;
205
205
206
+ #if (CO_CONFIG_SYNC ) & CO_CONFIG_SYNC_ENABLE
206
207
/* Process SYNC */
207
208
syncWas = CO_process_SYNC (co , TIME_I2US (chVTTimeElapsedSinceX (prev_time )), & timeout );
209
+ #endif
210
+ #if (CO_CONFIG_PDO ) & CO_CONFIG_RPDO_ENABLE
208
211
/* Read inputs */
209
212
CO_process_RPDO (co , syncWas , TIME_I2US (chVTTimeElapsedSinceX (prev_time )), & timeout );
213
+ #endif
214
+ #if (CO_CONFIG_PDO ) & CO_CONFIG_TPDO_ENABLE
210
215
/* Write outputs */
211
216
CO_process_TPDO (co , syncWas , TIME_I2US (chVTTimeElapsedSinceX (prev_time )), & timeout );
217
+ #endif
212
218
213
219
prev_time = chVTGetSystemTime ();
214
220
chEvtWaitAnyTimeout (CO_EVT_WAKEUP | CO_EVT_TERMINATE , TIME_US2I (timeout ));
215
221
}
216
222
CO_SYNC_initCallbackPre (co -> SYNC , NULL , NULL );
217
- #ifdef OD_CNT_RPDO
223
+ #if OD_CNT_RPDO > 0
218
224
for (int i = 0 ; i < OD_CNT_RPDO ; i ++ ) {
219
225
CO_RPDO_initCallbackPre (& co -> RPDO [i ], NULL , NULL );
220
226
}
@@ -345,7 +351,7 @@ void CO_init(CO_t **pCO, CANDriver *CANptr, uint8_t node_id, uint16_t bitrate, c
345
351
CO_t * CO = NULL ;
346
352
CO_ReturnError_t err ;
347
353
/* TODO: Use proper OD interface */
348
- #ifdef OD_CNT_RPDO
354
+ #if OD_CNT_RPDO > 0
349
355
struct {
350
356
uint8_t highestSub_indexSupported ;
351
357
uint32_t COB_IDUsedByRPDO ;
@@ -359,7 +365,7 @@ void CO_init(CO_t **pCO, CANDriver *CANptr, uint8_t node_id, uint16_t bitrate, c
359
365
RPDOCommParam [i ].COB_IDUsedByRPDO += node_id + i / 4 ;
360
366
}
361
367
#endif
362
- #ifdef OD_CNT_TPDO
368
+ #if OD_CNT_TPDO > 0
363
369
struct {
364
370
uint8_t highestSub_indexSupported ;
365
371
uint32_t COB_IDUsedByTPDO ;
0 commit comments