nico@215: nico@215: nico@215: CanFestival: include/states.h Source File nico@215: nico@215: nico@215: nico@215: nico@215:
nico@215:
nico@215:
nico@215:
nico@215: nico@215:

states.h

Go to the documentation of this file.
00001 /*
nico@215: 00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
nico@215: 00003 
nico@215: 00004 Copyright (C): Edouard TISSERANT and Francis DUPIN
nico@215: 00005 
nico@215: 00006 See COPYING file for copyrights details.
nico@215: 00007 
nico@215: 00008 This library is free software; you can redistribute it and/or
nico@215: 00009 modify it under the terms of the GNU Lesser General Public
nico@215: 00010 License as published by the Free Software Foundation; either
nico@215: 00011 version 2.1 of the License, or (at your option) any later version.
nico@215: 00012 
nico@215: 00013 This library is distributed in the hope that it will be useful,
nico@215: 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
nico@215: 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
nico@215: 00016 Lesser General Public License for more details.
nico@215: 00017 
nico@215: 00018 You should have received a copy of the GNU Lesser General Public
nico@215: 00019 License along with this library; if not, write to the Free Software
nico@215: 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
nico@215: 00021 */
nico@215: 00022 
nico@215: 00023 #ifndef __states_h__
nico@215: 00024 #define __states_h__
nico@215: 00025 
nico@215: 00026 #include <applicfg.h>
nico@215: 00027 
nico@215: 00028 /* The nodes states 
nico@215: 00029  * -----------------
nico@215: 00030  * values are choosen so, that they can be sent directly
nico@215: 00031  * for heartbeat messages...
nico@215: 00032  * Must be coded on 7 bits only
nico@215: 00033  * */
nico@215: 00034 /* Should not be modified */
etisserant@240: 00035 enum enum_nodeState {
etisserant@240: 00036   Initialisation  = 0x00, 
etisserant@240: 00037   Disconnected    = 0x01,
etisserant@240: 00038   Connecting      = 0x02,
etisserant@240: 00039   Preparing       = 0x02,
etisserant@240: 00040   Stopped         = 0x04,
etisserant@240: 00041   Operational     = 0x05,
etisserant@240: 00042   Pre_operational = 0x7F,
etisserant@240: 00043   Unknown_state   = 0x0F
nico@215: 00044 };
nico@215: 00045 
etisserant@240: 00046 typedef enum enum_nodeState e_nodeState;
nico@215: 00047 
nico@215: 00048 typedef struct
nico@215: 00049 {
etisserant@240: 00050         UNS8 csBoot_Up;
etisserant@240: 00051         UNS8 csSDO;
etisserant@240: 00052         UNS8 csEmergency;
etisserant@240: 00053         UNS8 csSYNC;
etisserant@240: 00054         UNS8 csHeartbeat;
etisserant@240: 00055         UNS8 csPDO;
nico@215: 00056 } s_state_communication;
nico@215: 00057 
etisserant@240: 00061 typedef void (*initialisation_t)(void);
etisserant@240: 00062 typedef void (*preOperational_t)(void);
etisserant@240: 00063 typedef void (*operational_t)(void);
etisserant@240: 00064 typedef void (*stopped_t)(void);
nico@215: 00065 
etisserant@240: 00066 void _initialisation(void);
etisserant@240: 00067 void _preOperational(void);
etisserant@240: 00068 void _operational(void);
etisserant@240: 00069 void _stopped(void);
nico@215: 00070 
nico@215: 00071 #include "data.h"
nico@215: 00072 
nico@215: 00073 /************************* prototypes ******************************/
nico@215: 00074 
etisserant@240: 00077 void canDispatch(CO_Data* d, Message *m);
nico@215: 00078 
etisserant@240: 00081 e_nodeState getState (CO_Data* d);
nico@215: 00082 
etisserant@240: 00085 UNS8 setState (CO_Data* d, e_nodeState newState);
nico@215: 00086 
etisserant@240: 00089 UNS8 getNodeId (CO_Data* d);
nico@215: 00090 
etisserant@240: 00093 void setNodeId (CO_Data* d, UNS8 nodeId);
nico@215: 00094 
nico@215: 00098 /* void initResetMode (CO_Data* d); */
nico@215: 00099 
nico@215: 00100 
etisserant@240: 00104 void initPreOperationalMode (CO_Data* d);
nico@215: 00105 
nico@215: 00106 #endif
etisserant@240: 

Generated on Mon Jul 2 19:10:16 2007 for CanFestival by  nico@215: nico@215: doxygen 1.5.1
nico@215: nico@215: