From 91f7afa1111d049dd40ef874e1f88dbe142e571c Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Thu, 20 Sep 2007 12:57:28 +0000 Subject: [PATCH] Added ec_sync_get_pdo_type(). --- master/sync.c | 23 +++++++++++++++++++++++ master/sync.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/master/sync.c b/master/sync.c index 0d968d17..e0fc1273 100644 --- a/master/sync.c +++ b/master/sync.c @@ -195,3 +195,26 @@ void ec_sync_clear_pdos( } /*****************************************************************************/ + +/** + */ + +ec_pdo_type_t ec_sync_get_pdo_type( + const ec_sync_t *sync /**< EtherCAT sync manager */ + ) +{ + int index = sync->index; + + if (sync->slave && sync->slave->sii_mailbox_protocols) { + index -= 2; + } + + if (index < 0 || index > 1) { + EC_WARN("ec_sync_get_pdo_type(): invalid sync manager index.\n"); + return EC_RX_PDO; + } + + return (ec_pdo_type_t) index; +} + +/*****************************************************************************/ diff --git a/master/sync.h b/master/sync.h index 11255a99..fca77151 100644 --- a/master/sync.h +++ b/master/sync.h @@ -83,6 +83,8 @@ void ec_sync_config(const ec_sync_t *, uint8_t *); int ec_sync_add_pdo(ec_sync_t *, const ec_pdo_t *); void ec_sync_clear_pdos(ec_sync_t *); +ec_pdo_type_t ec_sync_get_pdo_type(const ec_sync_t *); + /*****************************************************************************/ #endif