CANopen Bootloader Documentation
Version 4.10.00
Loading...
Searching...
No Matches
cbl_time.h File Reference

Detailed Description

The are a number of CANopen services which require an internal timer (e.g. Heartbeat). The timer values for these services are set in a multiple of 1 millisecond. The stack works internally with timer ticks. A timer tick has a resolution of 1 microsecond, the time span of a timer tick is set via the definition CBL_TIMER_PERIOD inside the cbl_conf.h file.

The requested time values are converted into timer ticks with the function CblTmrCalcTicks().

+ Include dependency graph for cbl_time.h:

Functions

uint16_t CblTmrCalcTicks (uint16_t uwReqTimingV)
 
void CblTmrEvent (void)
 

Function Documentation

◆ CblTmrCalcTicks()

uint16_t CblTmrCalcTicks ( uint16_t  uwReqTimingV)

Calculate number of timer ticks.

Parameters
uwReqTimingV- requested time in milliseconds
Returns
number of required timer ticks

The function calculates the number of required timer ticks (i.e. timer interrupts) based on the required time 'uwReqTimingV' (in milliseconds) and the constant value CBL_TIMER_PERIOD.

◆ CblTmrEvent()

void CblTmrEvent ( void  )

Execute Timer-based Services.

This routine must be called by a timer resource of the target system. It is responsible to call services that depend on a timer (e.g. Heartbeat). The period of the timer is defined via the CBL_TIMER_PERIOD constant.

Example

//-------------------------------------------------------------//
// Timer interrupt service routine //
// //
//-------------------------------------------------------------//
void MyTimerInterrupt(void)
{
//... timer services of application ...
//--- call CANopen Bootloader stack timer function -------
//... retrigger the timer
}
void CblTmrEvent(void)
Execute Timer-based Services.