Defining quick_index structures and ObjdictSize as constants
authorlbessard
Mon, 09 Jun 2008 11:13:45 +0200
changeset 479 92891f53630b
parent 478 4306e851d95c
child 480 d0d76932ad74
Defining quick_index structures and ObjdictSize as constants
objdictgen/gen_cfile.py
--- a/objdictgen/gen_cfile.py	Fri Jun 06 22:18:13 2008 +0200
+++ b/objdictgen/gen_cfile.py	Mon Jun 09 11:13:45 2008 +0200
@@ -412,7 +412,7 @@
                     maxPDOtransmit += 1
     texts["maxPDOtransmit"] = max(1, maxPDOtransmit)
     for index_cat in index_categories:
-        strQuickIndex += "\nquick_index %s_%s = {\n"%(texts["NodeName"], index_cat)
+        strQuickIndex += "\nconst quick_index %s_%s = {\n"%(texts["NodeName"], index_cat)
         sep = ","
         for i, (cat, idx_min, idx_max) in enumerate(categories):
             if i == len(categories) - 1:
@@ -508,7 +508,7 @@
 
     fileContent += strQuickIndex
     fileContent += """
-UNS16 %(NodeName)s_ObjdictSize = sizeof(%(NodeName)s_objdict)/sizeof(%(NodeName)s_objdict[0]); 
+const UNS16 %(NodeName)s_ObjdictSize = sizeof(%(NodeName)s_objdict)/sizeof(%(NodeName)s_objdict[0]); 
 
 CO_Data %(NodeName)s_Data = CANOPEN_NODE_DATA_INITIALIZER(%(NodeName)s);