examples/TestMasterMicroMod/TestMasterMicroMod.c
changeset 378 d2abf6c8c27b
parent 335 6052c980c3af
child 454 bc000083297a
equal deleted inserted replaced
377:bea5a1576cbd 378:d2abf6c8c27b
    40 #include "TestMaster.h"
    40 #include "TestMaster.h"
    41 UNS8 slavenodeid = 0x40;
    41 UNS8 slavenodeid = 0x40;
    42 
    42 
    43 
    43 
    44 /*****************************************************************************/
    44 /*****************************************************************************/
    45 void TestMaster_heartbeatError(UNS8 heartbeatID)
    45 void TestMaster_heartbeatError(CO_Data* d, UNS8 heartbeatID)
    46 {
    46 {
    47 	eprintf("TestMaster_heartbeatError %d\n", heartbeatID);
    47 	eprintf("TestMaster_heartbeatError %d\n", heartbeatID);
    48 }
    48 }
    49 
    49 
    50 /********************************************************
    50 /********************************************************
    51  * ConfigureSlaveNode is responsible to
    51  * ConfigureSlaveNode is responsible to
    52  *  - setup master RPDO 1 to receive TPDO 1 from id 0x40
    52  *  - setup master RPDO 1 to receive TPDO 1 from id 0x40
    53  *  - setup master TPDO 1 to send RPDO 1 to id 0x40
    53  *  - setup master TPDO 1 to send RPDO 1 to id 0x40
    54  ********************************************************/
    54  ********************************************************/
    55 void TestMaster_initialisation()
    55 void TestMaster_initialisation(CO_Data* d)
    56 {
    56 {
    57 	UNS32 PDO1_COBID = 0x0180 + slavenodeid; 
    57 	UNS32 PDO1_COBID = 0x0180 + slavenodeid; 
    58 	UNS32 PDO2_COBID = 0x0200 + slavenodeid;
    58 	UNS32 PDO2_COBID = 0x0200 + slavenodeid;
    59 	UNS8 size = sizeof(UNS32); 
    59 	UNS8 size = sizeof(UNS32); 
    60 
    60 
   301 			masterSendNMTstateChange (d, nodeId, NMT_Start_Node);
   301 			masterSendNMTstateChange (d, nodeId, NMT_Start_Node);
   302 	}
   302 	}
   303 			
   303 			
   304 }
   304 }
   305 
   305 
   306 void TestMaster_preOperational()
   306 void TestMaster_preOperational(CO_Data* d)
   307 {
   307 {
   308 
   308 
   309 	eprintf("TestMaster_preOperational\n");
   309 	eprintf("TestMaster_preOperational\n");
   310 	ConfigureSlaveNode(&TestMaster_Data, slavenodeid);
   310 	ConfigureSlaveNode(&TestMaster_Data, slavenodeid);
   311 	
   311 	
   312 }
   312 }
   313 
   313 
   314 void TestMaster_operational()
   314 void TestMaster_operational(CO_Data* d)
   315 {
   315 {
   316 	eprintf("TestMaster_operational\n");
   316 	eprintf("TestMaster_operational\n");
   317 }
   317 }
   318 
   318 
   319 void TestMaster_stopped()
   319 void TestMaster_stopped(CO_Data* d)
   320 {
   320 {
   321 	eprintf("TestMaster_stopped\n");
   321 	eprintf("TestMaster_stopped\n");
   322 }
   322 }
   323 
   323 
   324 void TestMaster_post_sync()
   324 void TestMaster_post_sync(CO_Data* d)
   325 {
   325 {
   326 	DO++;
   326 	DO++;
   327 	eprintf("MicroMod Digital Out: %2.2x\n",DO);
   327 	eprintf("MicroMod Digital Out: %2.2x\n",DO);
   328 	eprintf("MicroMod Digital In (by bit): DI1: %2.2x DI2: %2.2x DI3: %2.2x DI4: %2.2x DI5: %2.2x DI6: %2.2x DI7: %2.2x DI8: %2.2x\n",DI1,DI2,DI3,DI4,DI5,DI6,DI7,DI8);
   328 	eprintf("MicroMod Digital In (by bit): DI1: %2.2x DI2: %2.2x DI3: %2.2x DI4: %2.2x DI5: %2.2x DI6: %2.2x DI7: %2.2x DI8: %2.2x\n",DI1,DI2,DI3,DI4,DI5,DI6,DI7,DI8);
   329 }
   329 }
   330 
   330 
   331 void TestMaster_post_TPDO()
   331 void TestMaster_post_TPDO(CO_Data* d)
   332 {
   332 {
   333 //	eprintf("TestMaster_post_TPDO\n");	
   333 //	eprintf("TestMaster_post_TPDO\n");	
   334 }
   334 }
   335 
   335 
   336 //s_BOARD SlaveBoard = {"0", "500K"};
   336 //s_BOARD SlaveBoard = {"0", "500K"};