# HG changeset patch
# User etisserant
# Date 1188548386 -7200
# Node ID d221d387ad2fadb938cf6a7b6cec78ea48d3dc64
# Parent  f1c892f3f93c1c977ab94d375b6aac0b8dbf5a7a
Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)

diff -r f1c892f3f93c -r d221d387ad2f include/sync.h
--- a/include/sync.h	Thu Aug 30 17:03:34 2007 +0200
+++ b/include/sync.h	Fri Aug 31 10:19:46 2007 +0200
@@ -33,11 +33,12 @@
 typedef void (*post_TPDO_t)(void);
 void _post_TPDO(void);
 
-/** transmit a SYNC message on the bus number bus_id
- * bus_id is hardware dependant
- * return canSend(bus_id,&m)
+/** transmit a SYNC message and trigger sync TPDOs
  */
 UNS8 sendSYNC (CO_Data* d, UNS32 cob_id);
+/** transmit a SYNC message on CAN bus
+ */
+UNS8 sendSYNCMessage(CO_Data* d, UNS32 cob_id);
 
 /** This function is called when the node is receiving a SYNC message (cob-id = 0x80).
  *  - check if the node is in OERATIONAL mode. (other mode : return 0 but does nothing).
@@ -45,6 +46,6 @@
  *  - Trigger sync TPDO emission 
  *  - return 0 if OK, 0xFF if error
  */
-UNS8 proceedSYNC (CO_Data* d, Message * m);
+UNS8 proceedSYNC (CO_Data* d);
 
 #endif
diff -r f1c892f3f93c -r d221d387ad2f src/states.c
--- a/src/states.c	Thu Aug 30 17:03:34 2007 +0200
+++ b/src/states.c	Fri Aug 31 10:19:46 2007 +0200
@@ -68,7 +68,7 @@
 	{
 		case SYNC:
 			if(d->CurrentCommunicationState.csSYNC)
-				proceedSYNC(d,m);
+				proceedSYNC(d);
 			break;
 		/* case TIME_STAMP: */
 		case PDO1tx:
diff -r f1c892f3f93c -r d221d387ad2f src/sync.c
--- a/src/sync.c	Thu Aug 30 17:03:34 2007 +0200
+++ b/src/sync.c	Fri Aug 31 10:19:46 2007 +0200
@@ -110,9 +110,34 @@
 **/   
 void stopSYNC(CO_Data* d)
 {
+    RegisterSetODentryCallBack(d, 0x1005, 0, NULL);
+    RegisterSetODentryCallBack(d, 0x1006, 0, NULL);
 	d->syncTimer = DelAlarm(d->syncTimer);
 }
 
+
+/*!                                                                                                
+**                                                                                                 
+**                                                                                                 
+** @param d                                                                                        
+** @param cob_id                                                                                   
+**                                                                                                 
+** @return                                                                                         
+**/  
+UNS8 sendSYNCMessage(CO_Data* d, UNS32 cob_id)
+{
+  Message m;
+  
+  MSG_WAR(0x3001, "sendSYNC ", 0);
+  
+  m.cob_id.w = cob_id ;
+  m.rtr = NOT_A_REQUEST;
+  m.len = 0;
+  
+  return canSend(d->canHandle,&m);
+}
+
+
 /*!                                                                                                
 **                                                                                                 
 **                                                                                                 
@@ -123,17 +148,10 @@
 **/  
 UNS8 sendSYNC(CO_Data* d, UNS32 cob_id)
 {
-  Message m;
-  UNS8 resultat ;
-  
-  MSG_WAR(0x3001, "sendSYNC ", 0);
-  
-  m.cob_id.w = cob_id ;
-  m.rtr = NOT_A_REQUEST;
-  m.len = 0;
-  resultat = canSend(d->canHandle,&m) ;
-  proceedSYNC(d, &m) ; 
-  return resultat ;
+  UNS8 res;
+  res = sendSYNCMessage(d, cob_id);
+  proceedSYNC(d) ; 
+  return res ;
 }
 
 /*!                                                                                                
@@ -144,7 +162,7 @@
 **                                                                                                 
 ** @return                                                                                         
 **/ 
-UNS8 proceedSYNC(CO_Data* d, Message *m)
+UNS8 proceedSYNC(CO_Data* d)
 {
 
   UNS8 res;