CANopenADI
CANopenNode on Analog Devices Inc. MAX32xxx microcontrollers
Loading...
Searching...
No Matches
CO_application.h File Reference

Application interface for CANopenNode. More...

#include "CANopen.h"
+ Include dependency graph for CO_application.h:

Go to the source code of this file.

Functions

CO_ReturnError_t app_programStart (uint16_t *bitRate, uint8_t *nodeId, uint32_t *errInfo)
 Application interface, similar to Arduino, extended to CANopen and additional, realtime thread.
 
void app_communicationReset (CO_t *co)
 Function is called after CANopen communication reset.
 
void app_programEnd ()
 Function is called just before program ends.
 
void app_programAsync (CO_t *co, uint32_t timer1usDiff)
 Function is called cyclically from main().
 
void app_programRt (CO_t *co, uint32_t timer1usDiff)
 Function is called cyclically from realtime thread at constant intervals.
 
void app_peripheralRead (CO_t *co, uint32_t timer1usDiff)
 Function is called in the beginning of the realtime thread.
 
void app_peripheralWrite (CO_t *co, uint32_t timer1usDiff)
 Function is called in the end of the realtime thread.
 

Detailed Description

Application interface for CANopenNode.

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.

Function Documentation

◆ app_programStart()

CO_ReturnError_t app_programStart ( uint16_t * bitRate,
uint8_t * nodeId,
uint32_t * errInfo )

Application interface, similar to Arduino, extended to CANopen and additional, realtime thread.

Function is called once on the program startup, after Object dictionary initialization and before CANopen initialization.

Parameters
[in,out]bitRateStored CAN bit rate, can be overridden.
[in,out]nodeIdStored CANopen NodeId, can be overridden.
[out]errInfoVariable may indicate error information - index of erroneous OD entry.
Returns
CO_ReturnError_t CO_ERROR_NO in case of success.

◆ app_communicationReset()

void app_communicationReset ( CO_t * co)

Function is called after CANopen communication reset.

Parameters
coCANopen object.

◆ app_programAsync()

void app_programAsync ( CO_t * co,
uint32_t timer1usDiff )

Function is called cyclically from main().

Place for the slower code (all must be non-blocking).

Warning
Mind race conditions between this functions and following three functions (app_programRt() app_peripheralRead() and app_peripheralWrite()), which all run from the realtime thread. If accessing Object dictionary variable which is also mappable to PDO, it is necessary to use CO_LOCK_OD() and CO_UNLOCK_OD() macros from Critical sections.
Parameters
coCANopen object.
timer1usDiffTime difference since last call in microseconds

◆ app_programRt()

void app_programRt ( CO_t * co,
uint32_t timer1usDiff )

Function is called cyclically from realtime thread at constant intervals.

Code inside this function must be executed fast. Take care on race conditions with app_programAsync.

Parameters
coCANopen object.
timer1usDiffTime difference since last call in microseconds

◆ app_peripheralRead()

void app_peripheralRead ( CO_t * co,
uint32_t timer1usDiff )

Function is called in the beginning of the realtime thread.

Parameters
coCANopen object.
timer1usDiffTime difference since last call in microseconds

◆ app_peripheralWrite()

void app_peripheralWrite ( CO_t * co,
uint32_t timer1usDiff )

Function is called in the end of the realtime thread.

Parameters
coCANopen object.
timer1usDiffTime difference since last call in microseconds