CANopen Slave Documentation
Version 6.16.04
Loading...
Searching...
No Matches
Complete list of callbacks
//====================================================================================================================//
// File: cos_user.c //
// Description: Example for application specific functions //
// //
// Copyright (C) MicroControl GmbH & Co. KG //
// 53844 Troisdorf - Germany //
// www.microcontrol.net //
// //
//--------------------------------------------------------------------------------------------------------------------//
// The copyright to the computer program(s) herein is the property of MicroControl GmbH & Co. KG, Germany. The //
// program(s) may be used and/or copied only with the written permission of MicroControl GmbH & Co. KG or in //
// accordance with the terms and conditions stipulated in the agreement/contract under which the program(s) have //
// been supplied. //
// //
//====================================================================================================================//
/*--------------------------------------------------------------------------------------------------------------------*\
** IMPORTANT NOTE **
** This file provides a template for all functions that need to be adopted to YOUR hardware. Copy this file to **
** <myfile.c> and make your changes in the new file. **
\*--------------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------------------------------*\
** Include files **
** **
\*--------------------------------------------------------------------------------------------------------------------*/
#include "cos_dict.h" // Object dictionary
#include "cos_mgr.h" // CANopen Slave management functions
#include "cos_mobj.h" // Manufacturer objects
#include "cos_nmt.h" // NMT service
#include "cos_nvm.h" // Parameter storage
#include "cos_emcy.h" // EMCY service
#include "cos_pdo.h" // PDO service
#include "cos_sdo.h" // SDO service
#include "cos_sync.h" // SYNC service
#include "cos_time.h" // TIME service
#include "cos301.h" // Objects from DS-301
#if COS_DS302_NV > 0
#include "cos302.h"
#endif
#if COS_DS401_DI > 0
#include "cos401di.h"
#endif
#if COS_DS401_DO > 0
#include "cos401do.h"
#endif
#if COS_DICT_MAN > 0
#include "cos_mobj.h"
#endif
#if COS_SAFETY_SUPPORT == 1
#include "cos_safety.h"
#endif
#if COS_SDO_CLIENT > 0
#include "cos_sdo_cln.h"
#endif
/*--------------------------------------------------------------------------------------------------------------------*\
** Variables **
** **
\*--------------------------------------------------------------------------------------------------------------------*/
//------------------------------------------------------------------------------------------------------
// This object holds the device name of the target hardware as visible string
//
#if COS_DICT_OBJ_1008 == 1
uint8_t aubIdx1008_DeviceNameC[] = "CANopen Stack template";
#endif
//------------------------------------------------------------------------------------------------------
// This object holds the version number of the target hardware as visible string
//
#if COS_DICT_OBJ_1009 == 1
uint8_t aubIdx1009_HwVersionC[] = "1.00";
#endif
//------------------------------------------------------------------------------------------------------
// This object holds the version number of the application firmware as visible string
//
#if COS_DICT_OBJ_100A == 1
uint8_t aubIdx100A_SwVersionC[] = "1.00";
#endif
uint8_t ubIdx1018_SubNumberC = 0x04;
uint32_t ulIdx1018_VendorIdC = 0x00000000;
uint32_t ulIdx1018_RevisionNumC = ((uint32_t) COS_VERSION_MAJOR << 24) | ((uint32_t) COS_VERSION_MINOR << 16) | 0x0100;
//------------------------------------------------------------------------------------------------------
// reserve some memory for data of Trm & Rcv PDO
//
#if COS_PDO_RCV_NUMBER > 0
#ifdef __C51__
static uint8_t xdata aubRcvPdoDataT[8];
#else
static uint8_t aubRcvPdoDataT[8];
#endif
#endif
#if COS_PDO_TRM_NUMBER > 0
#ifdef __C51__
static uint8_t xdata aubTrmPdoDataT[8];
#else
static uint8_t aubTrmPdoDataT[8];
#endif
#endif
//------------------------------------------------------------------------------------------------------
// Devices with a fixed PDO mapping can have the mapping information in code space. The initialization
// of the structure has to be made here. The initialization code here is ONLY AN EXAMPLE! It has to be
// adopted to the device profile!
//
//-------------------------------------------------------------//
// Receive PDO mapping (fixed) //
// //
//-------------------------------------------------------------//
#if (COS_PDO_RCV_NUMBER > 0) && (COS_PDO_MAPPING == 0)
CosPdoMap_ts atsRcvPdoMapG[] =
{
//--- Index 1600 -----------------------------
{ 0x6200, 0x01, 0x08 },
{ 0x6200, 0x02, 0x08 },
{ 0x6200, 0x03, 0x08 },
{ 0x6200, 0x04, 0x08 },
{ 0x0000, 0x00, 0x00 },
//--- Index 1601 -----------------------------
{ 0x5210, 0x01, 0x10 },
{ 0x5210, 0x02, 0x10 },
{ 0x5210, 0x03, 0x10 },
{ 0x5210, 0x04, 0x10 },
{ 0x0000, 0x00, 0x00 }
};
#endif
//-------------------------------------------------------------//
// Transmit PDO mapping (fixed) //
// //
//-------------------------------------------------------------//
#if (COS_PDO_TRM_NUMBER > 0) && (COS_PDO_MAPPING == 0)
CosPdoMap_ts atsTrmPdoMapG[] =
{
//--- Index 1A00 -----------------------------
{ 0x7130, 0x01, 0x10 },
{ 0x7130, 0x02, 0x10 },
{ 0x7130, 0x03, 0x10 },
{ 0x7130, 0x04, 0x10 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
//--- Index 1A01 -----------------------------
{ 0x6000, 0x01, 0x08 },
{ 0x6000, 0x02, 0x08 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
//--- Index 1A02 -----------------------------
{ 0x6030, 0x00, 0x10 },
{ 0x6040, 0x00, 0x10 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
//--- Index 1A03 -----------------------------
{ 0x6030, 0x00, 0x10 },
{ 0x6040, 0x00, 0x10 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 },
{ 0x0000, 0x00, 0x00 }
};
#endif
/*--------------------------------------------------------------------------------------------------------------------*\
** Functions **
** **
\*--------------------------------------------------------------------------------------------------------------------*/
#if COS_DS302_NV > 0
//--------------------------------------------------------------------------------------------------------------------//
// Cos302_NetVarPdoRcvHandler() //
// //
//--------------------------------------------------------------------------------------------------------------------//
void Cos302_NetVarPdoRcvHandler(uint32_t ulMapEntryV)
{
uint8_t ubDataIndexT;
//----------------------------------------------------------------
// get data index once
//
ubDataIndexT = (uint8_t)(ulMapEntryV >> 8);
#if COS_PDO_RCV_NUMBER > 0
//----------------------------------------------------------------
// handle UNSIGNED8 output variables
//
if ((ulMapEntryV & 0x0FFF0000) == 0x04C00000)
{
//--------------------------------------------------------
// Now handle received network variable
//
if (tsCos302_NetVarG.aubOut[ubDataIndexT] != 0)
{
}
}
//----------------------------------------------------------------
// handle UNSIGNED16 output variables
//
else if ((ulMapEntryV & 0x0FFF0000) == 0x05800000)
{
//--------------------------------------------------------
// Now handle received network variable
//
if (tsCos302_NetVarG.auwOut[ubDataIndexT] != 0)
{
}
}
//----------------------------------------------------------------
// handle UNSIGNED32 output variables
//
else if ((ulMapEntryV & 0x0FFF0000) == 0x06800000)
{
//--------------------------------------------------------
// Now handle received network variable
//
if (tsCos302_NetVarG.aulOut[ubDataIndexT] != 0)
{
}
}
#endif
}
//--------------------------------------------------------------------------------------------------------------------//
// Cos302_NetVarPdoTrmHandler() //
// //
//--------------------------------------------------------------------------------------------------------------------//
void Cos302_NetVarPdoTrmHandler(uint32_t ulMapEntryV)
{
uint8_t ubDataIndexT;
//----------------------------------------------------------------
// get data index once
//
ubDataIndexT = (uint8_t)(ulMapEntryV >> 8);
#if COS_PDO_TRM_NUMBER > 0
//----------------------------------------------------------------
// handle UNSIGNED8 input variables
//
if ((ulMapEntryV & 0x0FFF0000) == 0x00400000)
{
//--------------------------------------------------------
// Now update transmit network variable
//
tsCos302_NetVarG.aubIn[ubDataIndexT]++;
}
//----------------------------------------------------------------
// handle UNSIGNED16 input variables
//
else if ((ulMapEntryV & 0x0FFF0000) == 0x01000000)
{
//--------------------------------------------------------
// Now update transmit network variable
//
tsCos302_NetVarG.auwIn[ubDataIndexT]++;
}
//----------------------------------------------------------------
// handle UNSIGNED32 input variables
//
else if ((ulMapEntryV & 0x0FFF0000) == 0x02000000)
{
//--------------------------------------------------------
// Now update transmit network variable
//
tsCos302_NetVarG.aulIn[ubDataIndexT]++;
}
#endif
}
#endif
#if COS_PDO_MAPPING > 0
#if COS_PDO_RCV_NUMBER > 0
//--------------------------------------------------------------------------------------------------------------------//
// CosMob_PdoRcvHandler() //
// Demo implementation of PDO receive handler for a mapping entry //
//--------------------------------------------------------------------------------------------------------------------//
void CosMob_PdoRcvHandler(uint32_t ulMapEntryV)
{
//---------------------------------------------------------------------------------------------------
// handle modification event at reception of desired RPDO
//
if (ulMapEntryV == 0x20020008)
{
}
}
#endif
#if COS_PDO_TRM_NUMBER > 0
//--------------------------------------------------------------------------------------------------------------------//
// CosMob_PdoTrmHandler() //
// Demo implementation of PDO transmit handler for mapping entries //
//--------------------------------------------------------------------------------------------------------------------//
void CosMob_PdoTrmHandler(uint32_t ulMapEntryV)
{
if (ulMapEntryV == 0x20040020)
{
// handle ulCosMob_Var2004G before it will copy and sent by TPDO
}
else
{
// handle uqCosMob_Var2005G before it will copy and sent by TPDO
}
}
#endif
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosMgrGetBitrate() //
// get module bit-rate setting //
//--------------------------------------------------------------------------------------------------------------------//
uint8_t CosMgrGetBitrate(void)
{
uint8_t ubBitrateT = 0; // value for bitrate
//---------------------------------------------------------------------------------------------------
// A value of 0 means the bitrate is not defined and we check the value from LSS
//
#if COS_LSS_SUPPORT > 0
if (ubBitrateT == 0)
{
McNvmRead(eNVM_305_BITRATE_U08, &ubBitrateT, 1);
}
#endif
//---------------------------------------------------------------------------------------------------
// set the Baudrate to a default in this example code
//
if ((ubBitrateT < eCP_BITRATE_50K) || (ubBitrateT > eCP_BITRATE_1M))
{
ubBitrateT = eCP_BITRATE_500K; // set to default in case of error
}
return (ubBitrateT);
}
//--------------------------------------------------------------------------------------------------------------------//
// CosMgrGetNodeId() //
// get module address setting //
//--------------------------------------------------------------------------------------------------------------------//
uint8_t CosMgrGetNodeId(void)
{
uint8_t ubAddrT = 0;
//----------------------------------------------------------------
// Example:
// Read value of DIP-/HEX-switch here
//
ubAddrT = 10;
//----------------------------------------------------------------
// A value of 0 means the address is not defined and we check
// the value from LSS
//
#if COS_LSS_SUPPORT > 0
if (ubAddrT == 0)
{
McNvmRead(eNVM_305_NODE_ID_U08, &ubAddrT, 1);
}
if (ubAddrT > 127) ubAddrT = 127; // limit in case of error
#else
#endif
return (ubAddrT);
}
//--------------------------------------------------------------------------------------------------------------------//
// CosMgrGetProductCode() //
// get Product Code of module //
//--------------------------------------------------------------------------------------------------------------------//
uint32_t CosMgrGetProductCode(void)
{
#if COS_DICT_OBJ_1010 > 0
Status_tv tvStatusT;
uint16_t uwNvmReadCrcT;
uint16_t uwNvmCalcCrcT;
uint32_t ulValueT;
#endif
uint32_t ulProductCodeT = 0;
//---------------------------------------------------------------------------------------------------
// read value from Non-volatile memory consider the data is valid or not
//
#if COS_DICT_OBJ_1010 > 0
uwNvmCalcCrcT = McNvmBuildChecksum(eNVM_CHECKSUM_START, eNVM_CHECKSUM_END);
tvStatusT = McNvmRead(eNVM_CHECKSUM_U16, (uint8_t *) &uwNvmReadCrcT, 2);
tvStatusT |= McNvmRead(eNVM_301_OBJ_1018_2_U32, (uint8_t *)&ulValueT, 4);
// update value only read was successfull and CRC OK
if (tvStatusT == eNVM_ERR_OK)
{
if (uwNvmCalcCrcT == uwNvmReadCrcT)
{
ulProductCodeT = ulValueT;
}
}
#endif
return (ulProductCodeT);
}
//--------------------------------------------------------------------------------------------------------------------//
// CosMgrGetSerialNumber() //
// get Serial Number of module //
//--------------------------------------------------------------------------------------------------------------------//
uint32_t CosMgrGetSerialNumber(void)
{
#if COS_DICT_OBJ_1010 > 0
Status_tv tvStatusT;
uint16_t uwNvmReadCrcT;
uint16_t uwNvmCalcCrcT;
uint32_t ulValueT;
#endif
uint32_t ulSerialNumberT = 0;
//---------------------------------------------------------------------------------------------------
// read serial number from Non-volatile memory consider the data is valid or not
//
#if COS_DICT_OBJ_1010 > 0
uwNvmCalcCrcT = McNvmBuildChecksum(eNVM_CHECKSUM_START, eNVM_CHECKSUM_END);
tvStatusT = McNvmRead(eNVM_CHECKSUM_U16, (uint8_t *) &uwNvmReadCrcT, 2);
tvStatusT |= McNvmRead(eNVM_301_OBJ_1018_4_U32, (uint8_t *)&ulValueT, 4);
// update value only read was successfull and CRC OK
if (tvStatusT == eNVM_ERR_OK)
{
if (uwNvmCalcCrcT == uwNvmReadCrcT)
{
ulSerialNumberT = ulValueT;
}
}
#endif
return (ulSerialNumberT);
}
//--------------------------------------------------------------------------------------------------------------------//
// CosMgrOnBootUp() //
// Handler for Boot-up event //
//--------------------------------------------------------------------------------------------------------------------//
void CosMgrOnBootUp(void)
{
}
//--------------------------------------------------------------------------------------------------------------------//
// CosMgrOnBusOff() //
// Handler for Bus-Off condition //
//--------------------------------------------------------------------------------------------------------------------//
void CosMgrOnBusOff(void)
{
}
//--------------------------------------------------------------------------------------------------------------------//
// CosMgrOnStart() //
// //
//--------------------------------------------------------------------------------------------------------------------//
void CosMgrOnStart(uint8_t ubCallerResultV)
{
//---------------------------------------------------------------------------------------------------
// Check status of initialization
//
switch (ubCallerResultV)
{
// no error
break;
// failed to initialise CAN interface
break;
// node-ID not valid
break;
// could not load parameters from NVM
break;
default:
break;
}
}
//--------------------------------------------------------------------------------------------------------------------//
// CosMgrProfileUpdate() //
// Handler for SDO Update of a profile //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_DS402 > 0
void CosMgrProfileUpdate(uint16_t uwIndexV, uint8_t ubSubIndexV)
{
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosNmtServiceOnError() //
// Handler for NMT protocol error //
//--------------------------------------------------------------------------------------------------------------------//
{
}
//--------------------------------------------------------------------------------------------------------------------//
// CosNmtServiceOnGuardingEvent() //
// Function handler for Life Guarding Event //
//--------------------------------------------------------------------------------------------------------------------//
{
}
//--------------------------------------------------------------------------------------------------------------------//
// CosNmtServiceOnHeartbeatEvent() //
// Function handler for Heartbeat Event //
//--------------------------------------------------------------------------------------------------------------------//
{
}
//--------------------------------------------------------------------------------------------------------------------//
// CosNmtServiceOnStart() //
// Function handler for NMT Start //
//--------------------------------------------------------------------------------------------------------------------//
{
//---------------------------------------------------------------------------------------------------
// this is an example for NMT start
// it has to be adopted to the device profile / application
//
#if COS_PDO_TRM_NUMBER > 0
CosPdoSend(0);
#endif
#if COS_PDO_TRM_NUMBER > 1
CosPdoSend(1);
#endif
#if COS_PDO_TRM_NUMBER > 2
CosPdoSend(2);
#endif
#if COS_PDO_TRM_NUMBER > 3
CosPdoSend(3);
#endif
}
//--------------------------------------------------------------------------------------------------------------------//
// CosNmtServiceOnStop() //
// Function handler for NMT Stop //
//--------------------------------------------------------------------------------------------------------------------//
{
}
//--------------------------------------------------------------------------------------------------------------------//
// CosNmtServiceOnPreOperational() //
// Function handler for NMT Pre-Operational //
//--------------------------------------------------------------------------------------------------------------------//
{
}
//--------------------------------------------------------------------------------------------------------------------//
// CosPdoComSetup() //
// update receive PDO data //
//--------------------------------------------------------------------------------------------------------------------//
void CosPdoComSetup(void)
{
//---------------------------------------------------------------------------------------------------
// This is an example for changing the default values of a PDO
// communication parameter record.
//
#if COS_PDO_TRM_NUMBER > 0
#endif
#if COS_PDO_TRM_NUMBER > 1
#endif
#if COS_PDO_TRM_NUMBER > 2
#endif
#if COS_PDO_TRM_NUMBER > 3
atsTrmPdoComG[3].ulIdentifier |= 0x80000000; // disable TPDO4
#endif
//---------------------------------------------------------------------------------------------------
// Receive PDO communication parameter
//
#if COS_PDO_RCV_NUMBER > 0
#endif
#if COS_PDO_RCV_NUMBER > 1
#endif
#if COS_PDO_RCV_NUMBER > 2
#endif
#if COS_PDO_RCV_NUMBER > 3
#endif
}
//--------------------------------------------------------------------------------------------------------------------//
// CosPdoRcvDataUpdate() //
// update receive PDO data //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_PDO_RCV_NUMBER > 0
void CosPdoRcvDataUpdate(uint8_t ubPdoNumberV)
{
uint8_t ubDlcT;
//----------------------------------------------------------------
// example for PDO receive update
//
CpCoreBufferGetData(&tsCanPortG, eCosBuf_PDO1_RCV + ubPdoNumberV,
&aubRcvPdoDataT[0], 0, 8);
CpCoreBufferGetDlc(&tsCanPortG, eCosBuf_PDO1_RCV + ubPdoNumberV,
&ubDlcT);
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosPdoTrmDataUpdate() //
// update transmit PDO data //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_PDO_TRM_NUMBER > 0
void CosPdoTrmDataUpdate(uint8_t ubPdoNumberV)
{
//----------------------------------------------------------------
// example for PDO transmit update
//
aubTrmPdoDataT[0] = 0x2F;
aubTrmPdoDataT[1] = 0x01;
aubTrmPdoDataT[2] = 0x20;
aubTrmPdoDataT[3] = 0x00;
aubTrmPdoDataT[4] = 0x01;
aubTrmPdoDataT[5] = 0x00;
aubTrmPdoDataT[6] = 0x00;
aubTrmPdoDataT[7] = 0x00;
CpCoreBufferSetData(&tsCanPortG,
eCosBuf_PDO1_TRM + ubPdoNumberV,
&aubTrmPdoDataT[0], 0, 8);
CpCoreBufferSetDlc(&tsCanPortG,
eCosBuf_PDO1_TRM + ubPdoNumberV,
8);
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosSafetySrdoRcvDataUpdate //
// //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_SAFETY_SUPPORT == 1
void CosSafetySrdoRcvDataUpdate(uint8_t ubSrdoNumberV)
{
static uint8_t aubSrdoDataS[8];
CosSafetySrdoGetData(ubSrdoNumberV, &aubSrdoDataS[0]);
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosSafetySrdoTrmDataUpdate //
// //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_SAFETY_SUPPORT == 1
void CosSafetySrdoTrmDataUpdate(uint8_t ubSrdoNumberV)
{
static uint8_t aubSrdoDataS[8] = { 0x00, 0x01, 0x55, 0x55, 0xAA, 0xAA, 0xCC, 0xCC};
CosSafetySrdoSetData(ubSrdoNumberV, &aubSrdoDataS[0]);
aubSrdoDataS[0]++;
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosSdoBlkDownFinal() //
// //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_SDO_BLOCK > 0
uint8_t CosSdoBlkDownFinal(uint16_t uwIndexV, uint8_t ubSubIndexV, uint32_t ulObjectSizeV)
{
(void) uwIndexV;
(void) ubSubIndexV;
(void) ulObjectSizeV;
return (eCosSdo_WRITE_OK);
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosSdoBlkDownObjectSize() //
// //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_SDO_BLOCK > 0
uint8_t CosSdoBlkDownObjectSize(uint16_t uwIndexV, uint8_t ubSubIndexV, uint32_t ulObjectSizeV)
{
(void) uwIndexV;
(void) ubSubIndexV;
(void) ulObjectSizeV;
return (eCosSdo_WRITE_OK);
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosSdoBlkUpObjectSize //
// //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_SDO_BLOCK > 0
uint32_t CosSdoBlkUpObjectSize(uint16_t uwIndexV, uint8_t ubSubIndexV)
{
uint32_t ulObjSizeT = 0;
(void) uwIndexV;
(void) ubSubIndexV;
return (ulObjSizeT);
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosSdoClnEventObjectReady() //
// //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_SDO_CLIENT > 0
void CosSdoClnEventObjectReady( uint8_t ubNodeIdV, CoObject_ts * ptsCoObjV, uint32_t * pulAbortV)
{
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosSdoClnEventTimeout() //
// //
//--------------------------------------------------------------------------------------------------------------------//
#if COS_SDO_CLIENT > 0
void CosSdoClnEventTimeout(uint8_t ubNodeIdV, CoObject_ts * ptsCoObjV)
{
}
#endif
//--------------------------------------------------------------------------------------------------------------------//
// CosSdoSegFinal() //
// //
//--------------------------------------------------------------------------------------------------------------------//
uint8_t CosSdoSegFinal(uint8_t CPP_PARM_UNUSED(ubReqCodeV), uint16_t CPP_PARM_UNUSED(uwIndexV),
uint8_t CPP_PARM_UNUSED(ubSubIndexV))
{
return (eCosSdo_WRITE_OK);
}
//--------------------------------------------------------------------------------------------------------------------//
// CosSyncEventRcvPdo() //
// //
//--------------------------------------------------------------------------------------------------------------------//
{
}
//--------------------------------------------------------------------------------------------------------------------//
// CosTmrTimeStampConsume() //
// //
//--------------------------------------------------------------------------------------------------------------------//
{
//------------------------------------------------------
// handle reception of TIME object
//
if ((ptsTimeStampV->ulMilliseconds) < 86400000)
{
if ((ptsTimeStampV->uwDays) > 0)
{
}
}
}
@ eCP_BITRATE_500K
Definition canpie.h:677
@ eCP_BITRATE_50K
Definition canpie.h:657
@ eCP_BITRATE_1M
Definition canpie.h:687
CANopen Slave Stack - CiA 301 objects .
uint32_t ulIdx1018_RevisionNumC
Identity object - revision number (Index 1018h)
uint8_t aubIdx100A_SwVersionC[]
Device software version (Index 100Ah)
uint8_t aubIdx1009_HwVersionC[]
Device hardware version (Index 1009h)
uint8_t ubIdx1018_SubNumberC
Identity object (Index 1018h)
uint32_t ulIdx1018_VendorIdC
Identity object - vendor ID (Index 1018h)
uint8_t aubIdx1008_DeviceNameC[]
Device name string (Index 1008h)
CANopen Slave Stack - CiA 302 Additional application layer functions .
Object Dictionary for CiA 401 (Digital Inputs) .
Object Dictionary for CiA 401 (Digital Outputs) .
@ eCosSdo_WRITE_OK
Definition cos_defs.h:315
#define COS_VERSION_MINOR
Definition cos_defs.h:97
@ eCosBuf_PDO1_RCV
Definition cos_defs.h:208
@ eCosBuf_PDO1_TRM
Definition cos_defs.h:213
@ eCOS_ERR_NONE
Definition cos_defs.h:504
@ eCOS_ERR_PARM_LOAD
Definition cos_defs.h:537
@ eCOS_ERR_VALUE_NODE_ID
Definition cos_defs.h:519
@ eCOS_ERR_CAN_INIT
Definition cos_defs.h:507
#define COS_VERSION_MAJOR
Definition cos_defs.h:87
CANopen Slave Stack - Dictionary .
CANopen Slave Stack - Emergency functions (EMCY) .
@ eEMCY_301_CAN_LIFEGUARD
Definition cos_emcy.h:386
Status_tv CosEmcyErrorSet(uint8_t ubErrConditionV, uint8_t *pubCustomerCodeV)
CANopen Slave Stack - Management functions .
uint8_t CosMgrGetNodeId(void)
void CosMgrOnBootUp(void)
void CosMgrOnStart(uint8_t ubCallerResultV)
uint32_t CosMgrGetProductCode(void)
uint32_t CosMgrGetSerialNumber(void)
void CosMgrProfileUpdate(uint16_t uwIndexV, uint8_t ubSubIndexV)
Update parameter of device profile.
void CosMgrOnBusOff(void)
Handle Bus-Off condition.
uint8_t CosMgrGetBitrate(void)
Get module bit-rate.
CANopen Slave Stack - Manufacturer specific objects .
void CosMob_PdoTrmHandler(uint32_t ulMapEntryV)
Demo implementation of callback handler for a mapping entry.
void CosMob_PdoRcvHandler(uint32_t ulMapEntryV)
Demo implementation of callback handler for a mapping entry.
CANopen Slave Stack - Network management functions (NMT) .
void CosNmtServiceOnHeartbeatEvent(void)
void CosNmtServiceOnError(void)
void CosNmtServiceOnPreOperational(void)
void CosNmtServiceOnStop(void)
void CosNmtServiceOnGuardingEvent(void)
void CosNmtServiceOnStart(void)
CANopen Slave Stack - Non-volatile memory support.
@ eNVM_301_OBJ_1018_2_U32
Definition cos_nvm.h:101
@ eNVM_301_OBJ_1018_4_U32
Definition cos_nvm.h:105
@ eNVM_305_BITRATE_U08
Definition cos_nvm.h:160
CANopen Slave Stack - Process Data Objects (PDO) .
CosPdoCom_ts atsTrmPdoComG[]
void CosPdoTrmDataUpdate(uint8_t ubPdoNumberV)
@ ePDO_TYPE_SYNC_1
Definition cos_pdo.h:160
@ ePDO_TYPE_EVENT_PROFILE
Definition cos_pdo.h:190
void CosPdoComSetup(void)
Setup application specific PDO communication parameter.
void CosPdoRcvDataUpdate(uint8_t ubPdoNumberV)
CosPdoCom_ts atsRcvPdoComG[]
CANopen Slave Stack - Functional safety .
void CosSafetySrdoRcvDataUpdate(uint8_t ubSrdoNumberV)
enum CosSafetyState_e CosSafetySrdoSetData(uint8_t ubSrdoNumberV, uint8_t *pubSrcDataV)
enum CosSafetyState_e CosSafetySrdoGetData(uint8_t ubSrdoNumberV, uint8_t *pubDestDataV)
void CosSafetySrdoTrmDataUpdate(uint8_t ubSrdoNumberV)
CANopen Slave Stack - Service Data Objects (SDO) .
uint32_t CosSdoBlkUpObjectSize(uint16_t uwIndexV, uint8_t ubSubIndexV)
Retrieve Object Size.
uint8_t CosSdoBlkDownFinal(uint16_t uwIndexV, uint8_t ubSubIndexV, uint32_t ulObjectSizeV)
uint8_t CosSdoSegFinal(uint8_t ubReqCodeV, uint16_t uwIndexV, uint8_t ubSubIndexV)
Handler for segmented SDO write.
uint8_t CosSdoBlkDownObjectSize(uint16_t uwIndexV, uint8_t ubSubIndexV, uint32_t ulObjectSizeV)
CANopen Slave Stack - Synchronisation functions (SYNC) .
void CosSyncEventRcvPdo(void)
Handle RPDOs on SYNC reception.
CANopen Slave Stack - Timing functions .
void CosTmrTimeStampConsume(CosTimeOfDay_ts *ptsTimeStampV)
uint16_t CosTmrCalcTicks(uint16_t uwReqTimingV)
CpStatus_tv CpCoreBufferGetData(CpPort_ts *ptsPortV, uint8_t ubBufferIdxV, uint8_t *pubDestDataV, uint8_t ubStartPosV, uint8_t ubSizeV)
Get data from message buffer.
CpStatus_tv CpCoreBufferSetDlc(CpPort_ts *ptsPortV, uint8_t ubBufferIdxV, uint8_t ubDlcV)
Set DLC of specified buffer.
CpStatus_tv CpCoreBufferSetData(CpPort_ts *ptsPortV, uint8_t ubBufferIdxV, uint8_t *pubSrcDataV, uint8_t ubStartPosV, uint8_t ubSizeV)
Set data of message buffer.
CpStatus_tv CpCoreBufferGetDlc(CpPort_ts *ptsPortV, uint8_t ubBufferIdxV, uint8_t *pubDlcV)
Get DLC of specified buffer.
int32_t Status_tv
Data type for status value.
Definition mc_compiler.h:268
#define CPP_PARM_UNUSED(x)
Definition mc_compiler.h:260
uint16_t McNvmBuildChecksum(NvmAddr_tv tvStartAddressV, NvmSize_tv tvDataCountV)
Build Checksum.
Status_tv McNvmRead(NvmAddr_tv tvAddressV, uint8_t *pubDataV, NvmSize_tv tvSizeV)
Read data.
uint16_t uwEventTick
Definition cos_pdo.h:254
uint32_t ulIdentifier
Definition cos_pdo.h:219
uint16_t uwEventTime
Definition cos_pdo.h:248
uint8_t ubTransType
Definition cos_pdo.h:224
PDO mapping parameter (static mapping)
Definition cos_pdo.h:301
Time of day.
Definition cos_time.h:87
uint32_t ulMilliseconds
Definition cos_time.h:91
uint16_t uwDays
Definition cos_time.h:96