examples/TestMasterSlaveLSS/Master.c
changeset 717 cfb4f62f35af
parent 517 003679edc437
child 718 0b33d9cdbdeb
equal deleted inserted replaced
711:4b64e17396af 717:cfb4f62f35af
    39  ********************************************************/
    39  ********************************************************/
    40 void TestMaster_initialisation(CO_Data* d)
    40 void TestMaster_initialisation(CO_Data* d)
    41 {
    41 {
    42 	UNS32 PDO1_COBID = 0x0182; 
    42 	UNS32 PDO1_COBID = 0x0182; 
    43 	UNS32 PDO2_COBID = 0x0183;
    43 	UNS32 PDO2_COBID = 0x0183;
    44 	UNS8 size = sizeof(UNS32); 
    44 	UNS32 size = sizeof(UNS32); 
    45 	
    45 	
    46 	eprintf("TestMaster_initialisation\n");
    46 	eprintf("TestMaster_initialisation\n");
    47 
    47 
    48 	/*****************************************
    48 	/*****************************************
    49 	 * Define RPDO to match slave ID=2 TPDO1*
    49 	 * Define RPDO to match slave ID=2 TPDO1*
    76 
    76 
    77 static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
    77 static void CheckSDOAndContinue(CO_Data* d, UNS8 nodeId)
    78 {
    78 {
    79 	UNS32 abortCode;	
    79 	UNS32 abortCode;	
    80 	if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
    80 	if(getWriteResultNetworkDict (d, nodeId, &abortCode) != SDO_FINISHED)
    81 		eprintf("Master : Failed in initializing slave %2.2x, step %d, AbortCode :%4.4x \n", nodeId, init_step, abortCode);
    81 		eprintf("Master : Failed in initializing slave %2.2x, AbortCode :%4.4x \n", nodeId, abortCode);
    82 
    82 
    83 	/* Finalise last SDO transfer with this node */
    83 	/* Finalise last SDO transfer with this node */
    84 	closeSDOtransfer(&TestMaster_Data, nodeId, SDO_CLIENT);
    84 	closeSDOtransfer(&TestMaster_Data, nodeId, SDO_CLIENT);
    85 
    85 
    86 	ConfigureSlaveNode(d, nodeId);
    86 	ConfigureSlaveNode(d, nodeId);
   124 					0x1800, /*UNS16 index*/
   124 					0x1800, /*UNS16 index*/
   125 					0x02, /*UNS8 subindex*/
   125 					0x02, /*UNS8 subindex*/
   126 					1, /*UNS8 count*/
   126 					1, /*UNS8 count*/
   127 					0, /*UNS8 dataType*/
   127 					0, /*UNS8 dataType*/
   128 					&Transmission_Type,/*void *data*/
   128 					&Transmission_Type,/*void *data*/
   129 					CheckSDOAndContinue); /*SDOCallback_t Callback*/
   129 					CheckSDOAndContinue, /*SDOCallback_t Callback*/
       
   130                     0); /*UNS8 useBlockMode*/
   130 					break;
   131 					break;
   131 		case 2: /* Second step : Set the new heartbeat producer time in the slave */
   132 		case 2: /* Second step : Set the new heartbeat producer time in the slave */
   132 		{
   133 		{
   133 			UNS32 Master_Cons_Heartbeat_T=Master_Cons_Heartbeat_Base + (nodeId * 0x10000);
   134 			UNS32 Master_Cons_Heartbeat_T=Master_Cons_Heartbeat_Base + (nodeId * 0x10000);
   134 			UNS8 size = sizeof(UNS32); 
   135 			UNS8 size = sizeof(UNS32); 
   139 					0x1017, /*UNS16 index*/
   140 					0x1017, /*UNS16 index*/
   140 					0x00, /*UNS8 subindex*/
   141 					0x00, /*UNS8 subindex*/
   141 					2, /*UNS8 count*/
   142 					2, /*UNS8 count*/
   142 					0, /*UNS8 dataType*/
   143 					0, /*UNS8 dataType*/
   143 					&Slave_Prod_Heartbeat_T,/*void *data*/
   144 					&Slave_Prod_Heartbeat_T,/*void *data*/
   144 					CheckSDOAndContinue); /*SDOCallback_t Callback*/
   145 					CheckSDOAndContinue, /*SDOCallback_t Callback*/
       
   146                     0); /*UNS8 useBlockMode*/
   145 					break;
   147 					break;
   146 					
   148 					
   147 			/* Set the new heartbeat consumer time in the master*/
   149 			/* Set the new heartbeat consumer time in the master*/
   148 			eprintf("Master : set Consumer Heartbeat Time for slave %2.2x = %d\n", nodeId,Master_Cons_Heartbeat_T);
   150 			eprintf("Master : set Consumer Heartbeat Time for slave %2.2x = %d\n", nodeId,Master_Cons_Heartbeat_T);
   149 			writeLocalDict( &TestMaster_Data, /*CO_Data* d*/
   151 			writeLocalDict( &TestMaster_Data, /*CO_Data* d*/