CANopenNode
CO_NMT_Heartbeat.h File Reference

CANopen Network management and Heartbeat producer protocol. More...

#include "301/CO_driver.h"
#include "301/CO_ODinterface.h"
#include "301/CO_Emergency.h"

Go to the source code of this file.

Data Structures

struct  CO_NMT_t
 NMT consumer and Heartbeat producer object. More...
 

Enumerations

enum  CO_NMT_internalState_t {
  CO_NMT_UNKNOWN = -1, CO_NMT_INITIALIZING = 0, CO_NMT_PRE_OPERATIONAL = 127, CO_NMT_OPERATIONAL = 5,
  CO_NMT_STOPPED = 4
}
 Internal network state of the CANopen node. More...
 
enum  CO_NMT_command_t {
  CO_NMT_ENTER_OPERATIONAL = 1, CO_NMT_ENTER_STOPPED = 2, CO_NMT_ENTER_PRE_OPERATIONAL = 128, CO_NMT_RESET_NODE = 129,
  CO_NMT_RESET_COMMUNICATION = 130
}
 Commands from NMT master. More...
 
enum  CO_NMT_reset_cmd_t { CO_RESET_NOT = 0, CO_RESET_COMM = 1, CO_RESET_APP = 2, CO_RESET_QUIT = 3 }
 Return code from CO_NMT_process() that tells application code what to reset. More...
 
enum  CO_NMT_control_t {
  CO_NMT_ERR_REG_MASK = 0x00FFU, CO_NMT_STARTUP_TO_OPERATIONAL = 0x0100U, CO_NMT_ERR_ON_BUSOFF_HB = 0x1000U, CO_NMT_ERR_ON_ERR_REG = 0x2000U,
  CO_NMT_ERR_TO_STOPPED = 0x4000U, CO_NMT_ERR_FREE_TO_OPERATIONAL = 0x8000U
}
 NMT control bitfield for NMT internal state. More...
 

Functions

CO_ReturnError_t CO_NMT_init (CO_NMT_t *NMT, const OD_entry_t *OD_1017_ProducerHbTime, CO_EM_t *em, uint8_t nodeId, CO_NMT_control_t NMTcontrol, uint16_t firstHBTime_ms, CO_CANmodule_t *NMT_CANdevRx, uint16_t NMT_rxIdx, uint16_t CANidRxNMT, CO_CANmodule_t *NMT_CANdevTx, uint16_t NMT_txIdx, uint16_t CANidTxNMT, CO_CANmodule_t *HB_CANdevTx, uint16_t HB_txIdx, uint16_t CANidTxHB)
 Initialize NMT and Heartbeat producer object. More...
 
void CO_NMT_initCallbackPre (CO_NMT_t *NMT, void *object, void(*pFunctSignal)(void *object))
 Initialize NMT callback function after message preprocessed. More...
 
void CO_NMT_initCallbackChanged (CO_NMT_t *NMT, void(*pFunctNMT)(CO_NMT_internalState_t state))
 Initialize NMT callback function. More...
 
CO_NMT_reset_cmd_t CO_NMT_process (CO_NMT_t *NMT, CO_NMT_internalState_t *NMTstate, uint32_t timeDifference_us, uint32_t *timerNext_us)
 Process received NMT and produce Heartbeat messages. More...
 
static CO_NMT_internalState_t CO_NMT_getInternalState (CO_NMT_t *NMT)
 Query current NMT state. More...
 
static void CO_NMT_setInternalState (CO_NMT_t *NMT, CO_NMT_internalState_t state)
 Set internal NMT state. More...
 
CO_ReturnError_t CO_NMT_sendCommand (CO_NMT_t *NMT, CO_NMT_command_t command, uint8_t nodeID)
 Send NMT master command. More...
 

Detailed Description

CANopen Network management and Heartbeat producer protocol.

Author
Janez Paternoster

This file is part of CANopenNode, an opensource CANopen Stack. Project home page is https://github.com/CANopenNode/CANopenNode. For more information on CANopen see http://www.can-cia.org/.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.