diff --git a/master/slave_config.c b/master/slave_config.c index 915ca0bd342becd711ff3f9e45d27d665fb37388..77c30b4204491a46a3ea6c9edebd713918a84f67 100644 --- a/master/slave_config.c +++ b/master/slave_config.c @@ -364,6 +364,26 @@ const ec_sdo_request_t *ec_slave_config_get_sdo_by_pos_const( return NULL; } +/*****************************************************************************/ + +/** Finds a VoE handler via its position in the list. + */ +ec_voe_handler_t *ec_slave_config_find_voe_handler( + ec_slave_config_t *sc, /**< Slave configuration. */ + unsigned int pos /**< Position in the list. */ + ) +{ + ec_voe_handler_t *voe; + + list_for_each_entry(voe, &sc->voe_handlers, list) { + if (pos--) + continue; + return voe; + } + + return NULL; +} + /****************************************************************************** * Realtime interface *****************************************************************************/ diff --git a/master/slave_config.h b/master/slave_config.h index 9ef850c7b9ec4f6e05f190bc66e71a7c71a87120..2ed2c9b1a16bce3cba3906da023b642bc28c539e 100644 --- a/master/slave_config.h +++ b/master/slave_config.h @@ -89,6 +89,8 @@ void ec_slave_config_load_default_sync_config(ec_slave_config_t *); unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *); const ec_sdo_request_t *ec_slave_config_get_sdo_by_pos_const( const ec_slave_config_t *, unsigned int); +ec_voe_handler_t *ec_slave_config_find_voe_handler(ec_slave_config_t *, + unsigned int); /*****************************************************************************/