A generic demo application, located inside the source/application/template-com/
directory, is used for all examples. Functions related to this demo have the prefix ComDemo
. The following code snippet shows a stripped version of the main()
function.
while (ComDemoAppRun() == true)
{
}
ComStatus_tv ComDemoAppInit(uint8_t ubNetV)
void ComDemoAppProcess(uint8_t ubNetV)
ComStatus_tv ComMgrProcess(uint8_t ubNetV)
CANopen demo initialization
A sample CANopen Master Stack initialization is implemented in the file source/application/template-com/com_demo_app.c
{
TMPL_COM_CONFIG);
{
}
#if COM_SYNC_SUPPORT > 0
{
}
#endif
tsComOptionsS[ubNetV].btNetIsActive = true;
return tvResultT;
}
@ eCP_BITRATE_500K
Definition canpie.h:677
@ eCOM_ERR_NONE
Definition com_defs.h:155
int32_t ComStatus_tv
Definition com_defs.h:116
ComStatus_tv ComDemoAppInitServices(uint8_t ubNetV)
void ComDemoAppConsoleError(const char *szMessageV, ComStatus_tv tvStatusV)
ComStatus_tv ComDemoAppInitTarget(uint8_t ubCanIfV, uint8_t ubNetV, ComDemoAppOptions_ts *ptsOptionsV)
ComStatus_tv ComDictAddList(uint8_t ubNetV, ComDicEntry_ts *ptsDictListV)
ComDicEntry_ts atsComDictMasterTableG[]
ComStatus_tv ComMgrStart(uint8_t ubNetV)
Start the CANopen Master.
ComStatus_tv ComMgrInit(uint8_t ubCanIfV, uint8_t ubNetV, uint8_t ubBitrateNomSelV, uint8_t ubNodeIdV, uint32_t ulModeV)
ComStatus_tv ComNmtMasterDetection(uint8_t ubNetV, uint8_t ubBootupV)
Start NMT master detection.
ComStatus_tv ComNmtSetHbProdTime(uint8_t ubNetV, uint16_t uwTimeV)
Set producer heartbeat time.
ComStatus_tv ComSyncSetCycleTime(uint8_t ubNetV, uint32_t ulTimeV)
CANopen demo processing
A sample CANopen Master Stack data processing is implemented in the file source/application/template-com/com_demo_app.c
{
#if COM_LSS_SUPPORT > 0
#endif
#if TARGET_IS_WINDOWS > 0
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
#endif
ComDemoAppIdle();
}
ComStatus_tv ComDemoLssProcess(uint8_t ubNetV)
ComStatus_tv ComDemoNmtProcess(uint8_t ubNetV)