![](/media/cache/profiles/IMG_2753.JPG.50x50_q85.jpg)
Can_open_masternode
framework/include/lifegrd.h@0:9dd7c6129683, 2011-05-30 (annotated)
- Committer:
- sam_grove
- Date:
- Mon May 30 07:36:47 2011 +0000
- Revision:
- 0:9dd7c6129683
Initial public release of master node example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove |
0:9dd7c6129683 | 1 | /* |
sam_grove |
0:9dd7c6129683 | 2 | This file is part of CanFestival, a library implementing CanOpen Stack. |
sam_grove |
0:9dd7c6129683 | 3 | |
sam_grove |
0:9dd7c6129683 | 4 | Copyright (C): Edouard TISSERANT and Francis DUPIN |
sam_grove |
0:9dd7c6129683 | 5 | |
sam_grove |
0:9dd7c6129683 | 6 | See COPYING file for copyrights details. |
sam_grove |
0:9dd7c6129683 | 7 | |
sam_grove |
0:9dd7c6129683 | 8 | This library is free software; you can redistribute it and/or |
sam_grove |
0:9dd7c6129683 | 9 | modify it under the terms of the GNU Lesser General Public |
sam_grove |
0:9dd7c6129683 | 10 | License as published by the Free Software Foundation; either |
sam_grove |
0:9dd7c6129683 | 11 | version 2.1 of the License, or (at your option) any later version. |
sam_grove |
0:9dd7c6129683 | 12 | |
sam_grove |
0:9dd7c6129683 | 13 | This library is distributed in the hope that it will be useful, |
sam_grove |
0:9dd7c6129683 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
sam_grove |
0:9dd7c6129683 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
sam_grove |
0:9dd7c6129683 | 16 | Lesser General Public License for more details. |
sam_grove |
0:9dd7c6129683 | 17 | |
sam_grove |
0:9dd7c6129683 | 18 | You should have received a copy of the GNU Lesser General Public |
sam_grove |
0:9dd7c6129683 | 19 | License along with this library; if not, write to the Free Software |
sam_grove |
0:9dd7c6129683 | 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
sam_grove |
0:9dd7c6129683 | 21 | */ |
sam_grove |
0:9dd7c6129683 | 22 | |
sam_grove |
0:9dd7c6129683 | 23 | /** @defgroup heartbeato Heartbeat Object |
sam_grove |
0:9dd7c6129683 | 24 | * The heartbeat mechanism for a device is established through cyclically transmitting a message by a |
sam_grove |
0:9dd7c6129683 | 25 | * heartbeat producer. One or more devices in the network are aware of this heartbeat message. If the |
sam_grove |
0:9dd7c6129683 | 26 | * heartbeat cycle fails for the heartbeat producer the local application on the heartbeat consumer will be |
sam_grove |
0:9dd7c6129683 | 27 | * informed about that event. |
sam_grove |
0:9dd7c6129683 | 28 | * @ingroup comobj |
sam_grove |
0:9dd7c6129683 | 29 | */ |
sam_grove |
0:9dd7c6129683 | 30 | |
sam_grove |
0:9dd7c6129683 | 31 | #ifndef __lifegrd_h__ |
sam_grove |
0:9dd7c6129683 | 32 | #define __lifegrd_h__ |
sam_grove |
0:9dd7c6129683 | 33 | |
sam_grove |
0:9dd7c6129683 | 34 | |
sam_grove |
0:9dd7c6129683 | 35 | #include <applicfg.h> |
sam_grove |
0:9dd7c6129683 | 36 | |
sam_grove |
0:9dd7c6129683 | 37 | typedef void (*heartbeatError_t)(CO_Data*, UNS8); |
sam_grove |
0:9dd7c6129683 | 38 | void _heartbeatError(CO_Data* d, UNS8 heartbeatID); |
sam_grove |
0:9dd7c6129683 | 39 | |
sam_grove |
0:9dd7c6129683 | 40 | typedef void (*post_SlaveBootup_t)(CO_Data*, UNS8); |
sam_grove |
0:9dd7c6129683 | 41 | void _post_SlaveBootup(CO_Data* d, UNS8 SlaveID); |
sam_grove |
0:9dd7c6129683 | 42 | |
sam_grove |
0:9dd7c6129683 | 43 | typedef void (*post_SlaveStateChange_t)(CO_Data*, UNS8, e_nodeState); |
sam_grove |
0:9dd7c6129683 | 44 | void _post_SlaveStateChange(CO_Data* d, UNS8 nodeId, e_nodeState newNodeState); |
sam_grove |
0:9dd7c6129683 | 45 | |
sam_grove |
0:9dd7c6129683 | 46 | #include "data.h" |
sam_grove |
0:9dd7c6129683 | 47 | |
sam_grove |
0:9dd7c6129683 | 48 | /************************************************************************* |
sam_grove |
0:9dd7c6129683 | 49 | * Functions |
sam_grove |
0:9dd7c6129683 | 50 | *************************************************************************/ |
sam_grove |
0:9dd7c6129683 | 51 | |
sam_grove |
0:9dd7c6129683 | 52 | /** |
sam_grove |
0:9dd7c6129683 | 53 | * @ingroup statemachine |
sam_grove |
0:9dd7c6129683 | 54 | * @brief To read the state of a node |
sam_grove |
0:9dd7c6129683 | 55 | * This can be used by the master after having sent a life guard request, |
sam_grove |
0:9dd7c6129683 | 56 | * of by any node if it is waiting for heartbeat. |
sam_grove |
0:9dd7c6129683 | 57 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:9dd7c6129683 | 58 | * @param nodeId Id of a node |
sam_grove |
0:9dd7c6129683 | 59 | * @return e_nodeState State of the node corresponding to the nodeId |
sam_grove |
0:9dd7c6129683 | 60 | */ |
sam_grove |
0:9dd7c6129683 | 61 | e_nodeState getNodeState (CO_Data* d, UNS8 nodeId); |
sam_grove |
0:9dd7c6129683 | 62 | |
sam_grove |
0:9dd7c6129683 | 63 | /** |
sam_grove |
0:9dd7c6129683 | 64 | * @brief Start heartbeat consumer and producer |
sam_grove |
0:9dd7c6129683 | 65 | * with respect to 0x1016 and 0x1017 |
sam_grove |
0:9dd7c6129683 | 66 | * object dictionary entries |
sam_grove |
0:9dd7c6129683 | 67 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:9dd7c6129683 | 68 | */ |
sam_grove |
0:9dd7c6129683 | 69 | void heartbeatInit(CO_Data* d); |
sam_grove |
0:9dd7c6129683 | 70 | |
sam_grove |
0:9dd7c6129683 | 71 | /** |
sam_grove |
0:9dd7c6129683 | 72 | * @brief Stop heartbeat consumer and producer |
sam_grove |
0:9dd7c6129683 | 73 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:9dd7c6129683 | 74 | */ |
sam_grove |
0:9dd7c6129683 | 75 | void heartbeatStop(CO_Data* d); |
sam_grove |
0:9dd7c6129683 | 76 | |
sam_grove |
0:9dd7c6129683 | 77 | /** |
sam_grove |
0:9dd7c6129683 | 78 | * @brief This function is responsible to process a canopen-message which seams to be an NMT Error Control |
sam_grove |
0:9dd7c6129683 | 79 | * Messages. At them moment we assume that every NMT error control message |
sam_grove |
0:9dd7c6129683 | 80 | * is a heartbeat message. |
sam_grove |
0:9dd7c6129683 | 81 | * If a BootUp message is detected, it will return the nodeId of the Slave who booted up |
sam_grove |
0:9dd7c6129683 | 82 | * @param *d Pointer on a CAN object data structure |
sam_grove |
0:9dd7c6129683 | 83 | * @param *m Pointer on the CAN-message which has to be analysed. |
sam_grove |
0:9dd7c6129683 | 84 | */ |
sam_grove |
0:9dd7c6129683 | 85 | void proceedNODE_GUARD (CO_Data* d, Message* m); |
sam_grove |
0:9dd7c6129683 | 86 | |
sam_grove |
0:9dd7c6129683 | 87 | #endif /*__lifegrd_h__ */ |