CANopen Slave Documentation
Version 6.16.04
Loading...
Searching...
No Matches
cos_mobj.h File Reference

Detailed Description

This module implements variables and callback functions for manufacturer specific objects. The header file and the corresponding implementation file provide example code. The code has to be adopted to the application by the manufacturer.

The following table gives an overview of the example objects in this file.

Index Example Function / Variable
2000h Access to an array of uint16_t CosMob_Idx2000
2001h Access to uint8_t with limit check CosMob_Idx2001
2002h Access to uint8_t value ubCosMob_Var2002G
2003h Access to uint16_t value uwCosMob_Var2003G
2004h Access to uint32_t value ulCosMob_Var2004G
2005h Access to uint64_t value uqCosMob_Var2005G
2006h Deferred SDO response CosMob_Idx2006
2007h Access to character string CosMob_Idx2007
2008h Access to character string szCosMob_Str2008G[]
2009h Write-only object, uint32_t value ulCosMob_Var2009G
+ Include dependency graph for cos_mobj.h:

Functions

void CosMob_ParmInit (void)
 
uint8_t CosMob_ParmLoad (void)
 
uint8_t CosMob_ParmSave (void)
 
uint8_t CosMob_Idx2000 (uint8_t ubSubIndexV, uint8_t ubReqCodeV)
 
uint8_t CosMob_Idx2001 (uint8_t ubSubIndexV, uint8_t ubReqCodeV)
 
uint8_t CosMob_Idx2006 (uint8_t ubSubIndexV, uint8_t ubReqCodeV)
 
uint8_t CosMob_Idx2007 (uint8_t ubSubIndexV, uint8_t ubReqCodeV)
 
void CosMob_PdoRcvHandler (uint32_t ulMapEntryV)
 
void CosMob_PdoTrmHandler (uint32_t ulMapEntryV)
 

Variables

uint8_t ubCosMob_Var2002G
 
uint16_t uwCosMob_Var2003G
 
uint32_t ulCosMob_Var2004G
 
char szCosMob_Str2008G []
 
uint32_t ulCosMob_Var2009G
 

Function Documentation

◆ CosMob_Idx2000()

uint8_t CosMob_Idx2000 ( uint8_t  ubSubIndexV,
uint8_t  ubReqCodeV 
)

Index 2000h - Example function 1.

Parameters
ubSubIndexV- sub-index
ubReqCodeV- read / write access
Returns
SDO response code

This function provides an example for read/write access to an array of values (16 bit unsigned). The size of the array is defined via the constant value MOB2000_SIZE inside the implementation file.

The function is called by the protocol stack.

The function returns a SDO response code defined by the CosSdo_e enumeration.

◆ CosMob_Idx2001()

uint8_t CosMob_Idx2001 ( uint8_t  ubSubIndexV,
uint8_t  ubReqCodeV 
)

Index 2001h - Example function 2.

Parameters
ubSubIndexV- sub-index
ubReqCodeV- read / write access
Returns
SDO response code

This function provides an example for read/write access to value with limit check.

The function is called by the protocol stack.

The function returns a SDO response code defined by the CosSdo_e enumeration.

◆ CosMob_Idx2006()

uint8_t CosMob_Idx2006 ( uint8_t  ubSubIndexV,
uint8_t  ubReqCodeV 
)

Index 2006h - Example function 3.

Parameters
ubSubIndexV- sub-index
ubReqCodeV- read / write access
Returns
SDO response code

This function provides an example for read/write access to an object with deferred SDO response. The application is responsible to sent a valid response later.

extern uint16_t uwMyValueG;
void MySdoResponse(void)
{
//---------------------------------------------------
// example for a read access
//
CosSdoCopyValueToMessage( (void *) &uwMyValueG, CoDT_UNSIGNED16);
}
@ CoDT_UNSIGNED16
Definition canopen.h:556
@ eCosSdo_READ2_OK
Definition cos_defs.h:298
void CosSdoResponse(uint8_t ubResponseV)
Evaluate SDO messages.
void CosSdoCopyValueToMessage(void *pValueV, uint8_t ubDataTypeV)
Copy value into SDO message.

The function is called by the protocol stack.

The function returns a SDO response code defined by the CosSdo_e enumeration.

◆ CosMob_Idx2007()

uint8_t CosMob_Idx2007 ( uint8_t  ubSubIndexV,
uint8_t  ubReqCodeV 
)

Index 2007h - Example function 4.

Parameters
ubSubIndexVsub-index
ubReqCodeVread / write access
Returns
SDO response code

This function provides an example for read/write access to a character string with segmented SDO transfer. On reception, the character string is tested for length and the value of the first character.

The function is called by the protocol stack.

The function returns a SDO response code defined by the CosSdo_e enumeration.

◆ CosMob_ParmInit()

void CosMob_ParmInit ( void  )

Initialise manufacturer variables.

See also
CosMgrParmInit()

This function is used to initialise manufacturer variables with default values. The code provides an example and has to be adopted to the application by the manufacturer.

The function is called by the protocol stack (CosMgrParmInit()).

◆ CosMob_ParmLoad()

uint8_t CosMob_ParmLoad ( void  )

Load manufacturer variables from NV-memory.

Returns
eCOS_ERR_NONE on success, eCOS_ERR_PARM_SAVE on failure
See also
CosMgrParmLoad()

This function is used to load manufacturer variables with previously stored values.

The function is called by the protocol stack (CosMgrParmLoad()).

◆ CosMob_ParmSave()

uint8_t CosMob_ParmSave ( void  )

Save manufacturer variables to NV-memory.

See also
CosMgrParmSave()
Returns
eCOS_ERR_NONE on success, eCOS_ERR_PARM_SAVE on failure

This function is used to save manufacturer variables to a non-volatile memory.

The function is called by the protocol stack (CosMgrParmSave()).

◆ CosMob_PdoRcvHandler()

void CosMob_PdoRcvHandler ( uint32_t  ulMapEntryV)

Demo implementation of callback handler for a mapping entry.

Parameters
ulMapEntryV- Mapping entry

◆ CosMob_PdoTrmHandler()

void CosMob_PdoTrmHandler ( uint32_t  ulMapEntryV)

Demo implementation of callback handler for a mapping entry.

Parameters
ulMapEntryV- Mapping entry

Variable Documentation

◆ szCosMob_Str2008G

char szCosMob_Str2008G[]
extern

Global variable for data direct access via SDO (read/write)

◆ ubCosMob_Var2002G

uint8_t ubCosMob_Var2002G
extern

Global variable for data direct access via SDO (read/write) and PDO (write only).

◆ ulCosMob_Var2004G

uint32_t ulCosMob_Var2004G
extern

Global variable for data direct access via SDO (read/write) and PDO (read only).

◆ ulCosMob_Var2009G

uint32_t ulCosMob_Var2009G
extern

Global variable for write-only via SDO

◆ uwCosMob_Var2003G

uint16_t uwCosMob_Var2003G
extern

Global variable for data direct access via SDO (read/write) and PDO (write only).