![](/media/cache/profiles/79f56e5e3e0e999b3c139f225838d41f.50x50_q85.jpg)
CANfestival - an open source CANopen framework
framework/include/sync.h@6:bc64031ac849, 2012-09-26 (annotated)
- Committer:
- sam_grove
- Date:
- Wed Sep 26 05:43:05 2012 +0000
- Revision:
- 6:bc64031ac849
- Parent:
- 0:6219434a0cb5
Change a typecast in can_mbed.cpp from unit8_t * to char * to fit the CANMessage constructor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove |
0:6219434a0cb5 | 1 | /* |
sam_grove |
0:6219434a0cb5 | 2 | This file is part of CanFestival, a library implementing CanOpen Stack. |
sam_grove |
0:6219434a0cb5 | 3 | |
sam_grove |
0:6219434a0cb5 | 4 | Copyright (C): Edouard TISSERANT and Francis DUPIN |
sam_grove |
0:6219434a0cb5 | 5 | |
sam_grove |
0:6219434a0cb5 | 6 | See COPYING file for copyrights details. |
sam_grove |
0:6219434a0cb5 | 7 | |
sam_grove |
0:6219434a0cb5 | 8 | This library is free software; you can redistribute it and/or |
sam_grove |
0:6219434a0cb5 | 9 | modify it under the terms of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 10 | License as published by the Free Software Foundation; either |
sam_grove |
0:6219434a0cb5 | 11 | version 2.1 of the License, or (at your option) any later version. |
sam_grove |
0:6219434a0cb5 | 12 | |
sam_grove |
0:6219434a0cb5 | 13 | This library is distributed in the hope that it will be useful, |
sam_grove |
0:6219434a0cb5 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
sam_grove |
0:6219434a0cb5 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
sam_grove |
0:6219434a0cb5 | 16 | Lesser General Public License for more details. |
sam_grove |
0:6219434a0cb5 | 17 | |
sam_grove |
0:6219434a0cb5 | 18 | You should have received a copy of the GNU Lesser General Public |
sam_grove |
0:6219434a0cb5 | 19 | License along with this library; if not, write to the Free Software |
sam_grove |
0:6219434a0cb5 | 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
sam_grove |
0:6219434a0cb5 | 21 | */ |
sam_grove |
0:6219434a0cb5 | 22 | |
sam_grove |
0:6219434a0cb5 | 23 | /** @defgroup synco Synchronisation Object |
sam_grove |
0:6219434a0cb5 | 24 | * SYNC object is a CANopen message forcing the receiving nodes to sample the inputs mapped into synchronous TPDOS. |
sam_grove |
0:6219434a0cb5 | 25 | * Receiving this message cause the node to set the outputs to values received in the previous synchronous RPDO. |
sam_grove |
0:6219434a0cb5 | 26 | * @ingroup comobj |
sam_grove |
0:6219434a0cb5 | 27 | */ |
sam_grove |
0:6219434a0cb5 | 28 | |
sam_grove |
0:6219434a0cb5 | 29 | #ifndef __SYNC_h__ |
sam_grove |
0:6219434a0cb5 | 30 | #define __SYNC_h__ |
sam_grove |
0:6219434a0cb5 | 31 | |
sam_grove |
0:6219434a0cb5 | 32 | void startSYNC(CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 33 | |
sam_grove |
0:6219434a0cb5 | 34 | void stopSYNC(CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 35 | |
sam_grove |
0:6219434a0cb5 | 36 | typedef void (*post_sync_t)(CO_Data*); |
sam_grove |
0:6219434a0cb5 | 37 | void _post_sync(CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 38 | |
sam_grove |
0:6219434a0cb5 | 39 | typedef void (*post_TPDO_t)(CO_Data*); |
sam_grove |
0:6219434a0cb5 | 40 | void _post_TPDO(CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 41 | |
sam_grove |
0:6219434a0cb5 | 42 | /** |
sam_grove |
0:6219434a0cb5 | 43 | * @brief Transmit a SYNC message and trigger sync TPDOs |
sam_grove |
0:6219434a0cb5 | 44 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 45 | * @return |
sam_grove |
0:6219434a0cb5 | 46 | */ |
sam_grove |
0:6219434a0cb5 | 47 | UNS8 sendSYNC (CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 48 | |
sam_grove |
0:6219434a0cb5 | 49 | /** |
sam_grove |
0:6219434a0cb5 | 50 | * @brief Transmit a SYNC message on CAN bus |
sam_grove |
0:6219434a0cb5 | 51 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 52 | * @return |
sam_grove |
0:6219434a0cb5 | 53 | */ |
sam_grove |
0:6219434a0cb5 | 54 | UNS8 sendSYNCMessage(CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 55 | |
sam_grove |
0:6219434a0cb5 | 56 | /** |
sam_grove |
0:6219434a0cb5 | 57 | * @brief This function is called when the node is receiving a SYNC message (cob-id = 0x80). |
sam_grove |
0:6219434a0cb5 | 58 | * - Check if the node is in OERATIONAL mode. (other mode : return 0 but does nothing). |
sam_grove |
0:6219434a0cb5 | 59 | * - Get the SYNC cobId by reading the dictionary index 1005, check it does correspond to the received cobId |
sam_grove |
0:6219434a0cb5 | 60 | * - Trigger sync TPDO emission |
sam_grove |
0:6219434a0cb5 | 61 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:6219434a0cb5 | 62 | * @return 0 if OK, 0xFF if error |
sam_grove |
0:6219434a0cb5 | 63 | */ |
sam_grove |
0:6219434a0cb5 | 64 | UNS8 proceedSYNC (CO_Data* d); |
sam_grove |
0:6219434a0cb5 | 65 | |
sam_grove |
0:6219434a0cb5 | 66 | #endif |