Sam Grove / Mbed 2 deprecated canopen_masternode

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sync.h Source File

sync.h

00001 /*
00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
00003 
00004 Copyright (C): Edouard TISSERANT and Francis DUPIN
00005 
00006 See COPYING file for copyrights details.
00007 
00008 This library is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU Lesser General Public
00010 License as published by the Free Software Foundation; either
00011 version 2.1 of the License, or (at your option) any later version.
00012 
00013 This library is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 Lesser General Public License for more details.
00017 
00018 You should have received a copy of the GNU Lesser General Public
00019 License along with this library; if not, write to the Free Software
00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00022 
00023 /** @defgroup synco Synchronisation Object
00024  *  SYNC object is a CANopen message forcing the receiving nodes to sample the inputs mapped into synchronous TPDOS.
00025  *  Receiving this message cause the node to set the outputs to values received in the previous synchronous RPDO.
00026  *  @ingroup comobj
00027  */
00028                      
00029 #ifndef __SYNC_h__
00030 #define __SYNC_h__
00031 
00032 void startSYNC (CO_Data* d);
00033 
00034 void stopSYNC (CO_Data* d);
00035 
00036 typedef void (*post_sync_t)(CO_Data*);
00037 void _post_sync(CO_Data* d);
00038 
00039 typedef void (*post_TPDO_t)(CO_Data*);
00040 void _post_TPDO(CO_Data* d);
00041 
00042 /** 
00043  * @brief Transmit a SYNC message and trigger sync TPDOs
00044  * @param *d Pointer on a CAN object data structure
00045  * @return
00046  */
00047 UNS8 sendSYNC (CO_Data* d);
00048 
00049 /** 
00050  * @brief Transmit a SYNC message on CAN bus
00051  * @param *d Pointer on a CAN object data structure
00052  * @return
00053  */
00054 UNS8 sendSYNCMessage(CO_Data* d);
00055 
00056 /** 
00057  * @brief This function is called when the node is receiving a SYNC message (cob-id = 0x80).
00058  *  - Check if the node is in OERATIONAL mode. (other mode : return 0 but does nothing).
00059  *  - Get the SYNC cobId by reading the dictionary index 1005, check it does correspond to the received cobId
00060  *  - Trigger sync TPDO emission 
00061  * @param *d Pointer on a CAN object data structure
00062  * @return 0 if OK, 0xFF if error 
00063  */
00064 UNS8 proceedSYNC (CO_Data* d);
00065 
00066 #endif