CANopen Master Documentation
Version 6.06.04
Loading...
Searching...
No Matches
com_node.h File Reference

Detailed Description

The CANopen Master node service can be used to share data between the CANopen slave device (node) and the CANopen Master protocol stack.

static ComNode_ts tsCoDeviceS; // structure with slave device data
ComNodeSetDefault(&tsCoDeviceS); // initialise structure
//-----------------------------------------------------------
// add this device as node with NID 2
//
ComMgrNodeAdd(eCOM_NET_1, 2, &tsCoDeviceS);
//-----------------------------------------------------------
// read mandatory values (i.e. objects 1000h & 1018h)
//
@ eCOM_NET_1
Definition com_defs.h:723
ComStatus_tv ComMgrNodeAdd(uint8_t ubNetV, uint8_t ubNodeIdV, ComNode_ts *ptsNodeV)
void ComNodeSetDefault(ComNode_ts *ptsNodeV)
ComStatus_tv ComNodeGetInfo(uint8_t ubNetV, uint8_t ubNodeIdV)
CANopen device parameter.
Definition com_node.h:110
+ Include dependency graph for com_node.h:

Data Structures

struct  ComNode_s
 

Typedefs

typedef struct ComNode_s ComNode_ts
 

Enumerations

enum  ComNodeParm_e {
  eCOM_NODE_PARM_ALL = 1 ,
  eCOM_NODE_PARM_COMMUNICATION = 2 ,
  eCOM_NODE_PARM_APPLICATION = 3 ,
  eCOM_NODE_PARM_MANUFACTURER = 4
}
 

Functions

ComStatus_tv ComNodeGetInfo (uint8_t ubNetV, uint8_t ubNodeIdV)
 
ComStatus_tv ComNodeRestore (uint8_t ubNetV, uint8_t ubNodeIdV, uint8_t ubParmSelV)
 
void ComNodeSetDefault (ComNode_ts *ptsNodeV)
 
ComStatus_tv ComNodeSetHbProdTime (uint8_t ubNetV, uint8_t ubNodeIdV, uint16_t uwHeartbeatV)
 
ComStatus_tv ComNodeStore (uint8_t ubNetV, uint8_t ubNodeIdV, uint8_t ubParmSelV)
 

Typedef Documentation

◆ ComNode_ts

typedef struct ComNode_s ComNode_ts

CANopen device parameter.

The structure ComNode_s keeps information about a CANopen device with a specific node-ID. In fact it holds a copy of several values from a CANopen slave device.

The elements within this structure are not ordered by index, they are ordered by data type (starting with unit32_t) in order to allow better packing, thus avoiding unaligned access.

Enumeration Type Documentation

◆ ComNodeParm_e

See also
ComNodeRestore(), ComNodeStore()

This enumeration defines the parameter options for storing / restoring.

Enumerator
eCOM_NODE_PARM_ALL 

Store or restore all parameters

eCOM_NODE_PARM_COMMUNICATION 

Store or restore communication parameters

eCOM_NODE_PARM_APPLICATION 

Store or restore application parameters

eCOM_NODE_PARM_MANUFACTURER 

Store or restore manufacturer parameters

Function Documentation

◆ ComNodeGetInfo()

ComStatus_tv ComNodeGetInfo ( uint8_t  ubNetV,
uint8_t  ubNodeIdV 
)
Parameters
[in]ubNetV- CANopen Network channel
[in]ubNodeIdV- Node-ID value
Returns
Value of enumeration ComErr_e

The function reads objects 1000h, 1001h, 1008h and 1018h. The device name string (object 1008h) can have a maximum length of 32 byte. All values are copied to the members inside the associated ComNode_ts structure.

This is a non-blocking function, it returns after the SDO transfer is initiated. The user is informed about the result of the transfer via the ComObjectEventReady() function. The message marker value is set to eCOM_OBJECT_MARKER_NODE_GET_INFO.

◆ ComNodeRestore()

ComStatus_tv ComNodeRestore ( uint8_t  ubNetV,
uint8_t  ubNodeIdV,
uint8_t  ubParmSelV 
)
Parameters
[in]ubNetV- CANopen Network channel
[in]ubNodeIdV- Node-ID value
[in]ubParmSelV- parameter group
Returns
Value of enumeration ComErr_e

The function starts the restore of parameters for the device with the given node-ID ubNodeIdV.

This is a non-blocking function, it returns after the SDO transfer is initiated. The user is informed about the result of the transfer via the ComObjectEventReady() function. The message marker value is set to eCOM_OBJECT_MARKER_NODE_RESTORE.

◆ ComNodeSetDefault()

void ComNodeSetDefault ( ComNode_ts ptsNodeV)
Parameters
[in]ptsNodeV- Pointer to CANopen node

Initialise CANopen node structure with default values.

◆ ComNodeSetHbProdTime()

ComStatus_tv ComNodeSetHbProdTime ( uint8_t  ubNetV,
uint8_t  ubNodeIdV,
uint16_t  uwHeartbeatV 
)
Parameters
[in]ubNetV- CANopen Network channel
[in]ubNodeIdV- Node-ID value
[in]uwHeartbeatV- Heartbeat value
Returns
Value of enumeration ComErr_e

The function sets object 1017h for the device with the given node-ID ubNodeIdV.

This is a non-blocking function, it returns after the SDO transfer is initiated. The user is informed about the result of the transfer via the ComObjectEventReady() function. The message marker value is set to eCOM_OBJECT_MARKER_NODE_SET_HEARTBEAT.

◆ ComNodeStore()

ComStatus_tv ComNodeStore ( uint8_t  ubNetV,
uint8_t  ubNodeIdV,
uint8_t  ubParmSelV 
)
Parameters
[in]ubNetV- CANopen Network channel
[in]ubNodeIdV- Node-ID value
[in]ubParmSelV- parameter group
Returns
Value of enumeration ComErr_e

The function starts the saving of parameters for the device with the given node-ID ubNodeIdV.

This is a non-blocking function, it returns after the SDO transfer is initiated. The user is informed about the result of the transfer via the ComObjectEventReady() function. The message marker value is set to eCOM_OBJECT_MARKER_NODE_STORE.