📄 app.h
字号:
/***************************************************************************
app.h - description
-------------------
begin : Fri May 17 2002
copyright : (C) 2002 by Raphael Zulliger
email : zulli@hsr.ch
***************************************************************************/
/***************************************************************************
* *
* This library is Copyright (c) Raphael Zulliger <zulli@gmx.net>. *
* It is licensed under the GNU Library General Public License (LGPL). *
* *
***************************************************************************/
/** \file
* \brief Contains the user-code
*
* This file contains the user-code. Therefore the user has to put his c-code
* into the correct state-machine functions.
*/
#ifndef __app_h__
#define __app_h__
#include <def.h>
/** This define is important especially for microcontrollers: it tells the
* slavelib the CPU speed. This is neccessary for setting up timers for
* heartbeat and the CAN controller (baudrate setting)
*/
#define FOSC 4000 // in kHz
/** This function is called, when a remote node tells this node to
* stopp this node. in this state, no SDO, no PDO, no SYNC, no Time
* stamp, no emergency messages are allowed to send/receive
* --> only NMT, LSS, and (in some cases) Error control Objects can
* be processed
* In this function you have to loop with a while-loop:
* while( bStateMachineState == STOPPED )
* {
* // because sending of heartbeat must start just after bootup, lets do that...
* processLifeGuard( );
* proccessRxCanMessages( );
* }
*/
void stopped( void );
/** This function is called automatically by the statemachine, when the
* microcontroller powers up. after execution of the function initialisation
* the state machine changes into pre-operational state.
* In this function you have to loop with a while-loop:
* while( bStateMachineState == PRE_OPERATIONAL )
* {
* // because sending of heartbeat must start just after bootup, lets do that...
* processLifeGuard( );
* proccessRxCanMessages( );
* }
*/
void preOperational( void );
/** The statemachine calles this function, if a NMT message was received from
* the NMT master that tells this node to change into operational state.
* in this state the CANopen device sends/receives PDOs and all other message
* types (but not: Boot-Up Object and LSS Objects)
* this function must contain a while-loop like this:
* while( bStateMachineState == OPERATIONAL )
* {
* // because sending of heartbeat must start just after bootup, lets do that...
* processLifeGuard( );
* proccessRxCanMessages( );
* // user defined code follows here (or somewhere else in the while-loop)
* }
*/
void operational( void );
/** This function is called automatically by the statemachine, when the
* microcontroller powers up. after execution of this function the
* state machine automatically changes into pre-operational state.
* So don't make loops here (while( getState( ) == INITIALISATION_NODE) )
*/
void initialisation( void );
// user defined functions
void Setup(void);
void InterruptHandlerHigh(void);
// at this I/O the CAN-transceiver device is connected to the pic
#define SILENT_MODE PORTBbits.RB0
#endif // __app_h__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -