src/objacces.c
changeset 8 eee2b0c89213
parent 2 8d4a822f95e4
child 10 0c4d04e5fac0
equal deleted inserted replaced
7:126e37bcca0f 8:eee2b0c89213
    22 
    22 
    23 //#define DEBUG_WAR_CONSOLE_ON
    23 //#define DEBUG_WAR_CONSOLE_ON
    24 //#define DEBUG_ERR_CONSOLE_ON
    24 //#define DEBUG_ERR_CONSOLE_ON
    25 
    25 
    26 #include "objacces.h"
    26 #include "objacces.h"
       
    27 
    27 
    28 
    28 #ifdef DEBUG_WAR_CONSOLE_ON
    29 #ifdef DEBUG_WAR_CONSOLE_ON
    29 UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, 
    30 UNS8 accessDictionaryError(UNS16 index, UNS8 subIndex, 
    30 			     UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code)
    31 			     UNS8 sizeDataDict, UNS8 sizeDataGiven, UNS32 code)
    31 {
    32 {
    96   if(	*pExpectedSize == 0 ||
    97   if(	*pExpectedSize == 0 ||
    97   	*pExpectedSize == szData ||
    98   	*pExpectedSize == szData ||
    98   	(*pDataType == visible_string && *pExpectedSize > szData)) // We allow to fetch a shorter string than expected
    99   	(*pDataType == visible_string && *pExpectedSize > szData)) // We allow to fetch a shorter string than expected
    99   {
   100   {
   100 	#ifdef CANOPEN_BIG_ENDIAN
   101 	#ifdef CANOPEN_BIG_ENDIAN
   101 	      if(*pDataType > boolean && dataType < visible_string){
   102 	      if(*pDataType > boolean && pDataType < visible_string){
   102 	      {
       
   103 		// data must be transmited with low byte first
   103 		// data must be transmited with low byte first
   104 		UNS8 i, j = 0;
   104 		UNS8 i, j = 0;
   105 		for ( i = ptrTable->pSubindex[bSubindex].size ; i > 0 ; i--) {
   105 		for ( i = ptrTable->pSubindex[bSubindex].size ; i > 0 ; i--) {
   106 			((char*)pDestData)[j++] = ((char*)ptrTable->pSubindex[bSubindex].pObject)[i-1];
   106 			((char*)pDestData)[j++] = ((char*)ptrTable->pSubindex[bSubindex].pObject)[i-1];
   107 		}
   107 		}