CONmtGetMode
Description
This function returns the current CANopen NMT state machine mode.
Prototype
CO_MODE CONmtGetMode(CO_NMT *nmt);
Parameter | Description |
---|---|
nmt | reference to NMT structure |
Returned Value
>0 The current NMT mode
=0 An error is detected
Additional Information
The following table shows the possible values of the type CO.MODE
:
Value | Description |
---|---|
CO_INVALID | Device in INVALID mode, e.g. not initialized |
CO_INIT | Device in INIT mode |
CO_PREOP | Device in PRE-OPERATIONAL mode |
CO_OPERATIONAL | Device in OPERATIONAL mode |
CO_STOP | Device in STOP mode |
Example
The following example shows how to perform operations only in operational mode of the CANopen node AppNode:
CO_MODE mode; : mode = CONmtGetMode (&(AppNode.Nmt)); if (mode == CO_OPERATIONAL) { /* perform actions in operational mode */ } :