include/sync.h
changeset 528 0a30e161d63c
parent 378 d2abf6c8c27b
child 529 c171e11707c5
equal deleted inserted replaced
527:7d5c74cc8f91 528:0a30e161d63c
    18 You should have received a copy of the GNU Lesser General Public
    18 You should have received a copy of the GNU Lesser General Public
    19 License along with this library; if not, write to the Free Software
    19 License along with this library; if not, write to the Free Software
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 */
    21 */
    22 
    22 
       
    23 /** @defgroup synco Synchronisation Object
       
    24  *  SYNC object is a CANopen message forcing the receiving nodes to sample the inputs mapped into synchronous TPDOS.
       
    25  *  Receiving this message causse the node to set the outputs to values received in the previous synchronous RPDO.
       
    26  *  @ingroup comobj
       
    27  */
       
    28 					 
    23 #ifndef __SYNC_h__
    29 #ifndef __SYNC_h__
    24 #define __SYNC_h__
    30 #define __SYNC_h__
    25 
    31 
    26 void startSYNC(CO_Data* d);
    32 void startSYNC(CO_Data* d);
    27 
    33 
    31 void _post_sync(CO_Data* d);
    37 void _post_sync(CO_Data* d);
    32 
    38 
    33 typedef void (*post_TPDO_t)(CO_Data*);
    39 typedef void (*post_TPDO_t)(CO_Data*);
    34 void _post_TPDO(CO_Data* d);
    40 void _post_TPDO(CO_Data* d);
    35 
    41 
    36 /** transmit a SYNC message and trigger sync TPDOs
    42 /** 
       
    43  * @ingroup synco
       
    44  * @brief Transmit a SYNC message and trigger sync TPDOs
       
    45  * @param *d Pointer on a CAN object data structure
       
    46  * @return
    37  */
    47  */
    38 UNS8 sendSYNC (CO_Data* d);
    48 UNS8 sendSYNC (CO_Data* d);
    39 /** transmit a SYNC message on CAN bus
    49 
       
    50 /** 
       
    51  * @ingroup synco
       
    52  * @brief Transmit a SYNC message on CAN bus
       
    53  * @param *d Pointer on a CAN object data structure
       
    54  * @return
    40  */
    55  */
    41 UNS8 sendSYNCMessage(CO_Data* d);
    56 UNS8 sendSYNCMessage(CO_Data* d);
    42 
    57 
    43 /** This function is called when the node is receiving a SYNC message (cob-id = 0x80).
    58 /** 
    44  *  - check if the node is in OERATIONAL mode. (other mode : return 0 but does nothing).
    59  * @brief This function is called when the node is receiving a SYNC message (cob-id = 0x80).
       
    60  *  - Check if the node is in OERATIONAL mode. (other mode : return 0 but does nothing).
    45  *  - Get the SYNC cobId by reading the dictionary index 1005, check it does correspond to the received cobId
    61  *  - Get the SYNC cobId by reading the dictionary index 1005, check it does correspond to the received cobId
    46  *  - Trigger sync TPDO emission 
    62  *  - Trigger sync TPDO emission 
    47  *  - return 0 if OK, 0xFF if error
    63  * @param *d Pointer on a CAN object data structure
       
    64  * @return 0 if OK, 0xFF if error 
    48  */
    65  */
    49 UNS8 proceedSYNC (CO_Data* d);
    66 UNS8 proceedSYNC (CO_Data* d);
    50 
    67 
    51 #endif
    68 #endif