Fixed Pdo configuration information providing.
authorFlorian Pose <fp@igh-essen.com>
Tue, 19 Feb 2008 09:21:13 +0000
changeset 793 3b297ff8284f
parent 792 3778920f61e4
child 794 684dea874956
Fixed Pdo configuration information providing.
examples/mini/mini.c
include/ecrt.h
master/pdo_mapping.c
--- a/examples/mini/mini.c	Tue Feb 19 08:22:20 2008 +0000
+++ b/examples/mini/mini.c	Tue Feb 19 09:21:13 2008 +0000
@@ -64,9 +64,19 @@
 #endif
 
 #ifdef MAPPING
+const ec_pdo_entry_info_t el3162_channel1[] = {
+    {0x3101, 1,  8}, // status
+    {0x3101, 2, 16}  // value
+};
+
+const ec_pdo_entry_info_t el3162_channel2[] = {
+    {0x3102, 1,  8}, // status
+    {0x3102, 2, 16}  // value
+};
+
 const ec_pdo_info_t mapping[] = {
-    {EC_DIR_INPUT, 0x1A00}, // channel 1
-    {EC_DIR_INPUT, 0x1A01} // channel 2
+    {EC_DIR_INPUT, 0x1A00, 2, el3162_channel1},
+    {EC_DIR_INPUT, 0x1A01, 2, el3162_channel2},
 };
 #endif
 
--- a/include/ecrt.h	Tue Feb 19 08:22:20 2008 +0000
+++ b/include/ecrt.h	Tue Feb 19 09:21:13 2008 +0000
@@ -221,7 +221,9 @@
     unsigned int n_entries; /**< Number of Pdo entries for the Pdo
                               configuration. Zero means, that the default Pdo
                               configuration shall be used. */
-    const ec_pdo_entry_info_t entries[]; /**< Pdo configuration list. */
+    const ec_pdo_entry_info_t *entries; /**< Pdo configuration array. This
+                                          array must contain at least \a
+                                          n_entries values. */
 } ec_pdo_info_t;
 
 /*****************************************************************************/
--- a/master/pdo_mapping.c	Tue Feb 19 08:22:20 2008 +0000
+++ b/master/pdo_mapping.c	Tue Feb 19 09:21:13 2008 +0000
@@ -185,7 +185,7 @@
     if (config->master->debug_level)
         EC_INFO("Adding Pdo 0x%04X to mapping.\n", pdo->index);
 
-    if (pdo_info->n_entries) { // Pdo configuration provided
+    if (pdo_info->n_entries && pdo_info->entries) { // configuration provided
         if (config->master->debug_level)
             EC_INFO("  Pdo configuration provided.\n");