DolphinV4 API  1.6.1.0
TIMER1 functions
Collaboration diagram for TIMER1 functions:

Macros

#define timer1_setConfig(pu16Param, u8Index, u16NewValue)   pu16Param[u8Index]=u16NewValue; timer1_init(pu16Param,u8Index);

Functions

void timer1_init (uint16 *pu16Param, uint8 u8ParamToSet)
void timer1_initCB (void code *pu16FnPtr)
void timer1_enableCB (uint8 u8Enable)
void timer1_enable (uint8 u8Enable)
void timer1_getTimerCounter (uint16 *pu16Count)
void timer1_resetCounter ()

Detailed Description

The TIMER1 module gives an interface to a 16bit HW timer which can be used for custom application purposes.
This module offers:

See the source code and description of the RSSI Example for more information how the PWM works.
Note:
Timer1 callback function will be called from interrupt. As timer1 interrupt belong to the group of interrupt with lowest priority it is possible that the Timer1 callback has to wait till radio, scheduler (timer0), i/o callback or uart interrupt is executed. It is not possible to guaranty a minimum time from triggering any interrupt till execution of the interrupt service routine.


Macro Definition Documentation

#define timer1_setConfig (   pu16Param,
  u8Index,
  u16NewValue 
)    pu16Param[u8Index]=u16NewValue; timer1_init(pu16Param,u8Index);

Sets one timer1 parameter

Parameters:
[in]*pu16ParamPointer to the list of parameters to set. See #time_param[]
[in]u8IndexIndex of parameter to set. See #TIME_PARAM_IDX
[in]u16NewValueThe parameter value
Returns:
-
See also:
timer1_init, TIMER1_PARAM_IDX

Function Documentation

void timer1_init ( uint16 *  pu16Param,
uint8  u8ParamToSet 
)

Sets all the timer1 parameters

Parameters:
[in]*pu16ParamPointer to the list of parameters to set. See #timer1_param[]
[in]u8ParamToSetIt has to be SET_ALL_PARAM to set all parameters in the list
Returns:
-
See also:
timer1_setConfig, TIMER1_PARAM_IDX
void timer1_initCB ( void code *  pu16FnPtr)

Sets function pointer for callback function in interrupt and enables the callback interrupt generation

Parameters:
[in]*pu16FnPtrPointer to the callback function which will be called when timer1 generates an interrupt
Returns:
-
See also:
timer1_enableCB
void timer1_enableCB ( uint8  u8Enable)

Enables or disables callback when timer1 generates an interrupt

Parameters:
[in]u8EnableTRUE, callback enabled, FALSE, callback disabled
Returns:
-
Note:
Do not stay in the callback function too long (not more than 100 us because that takes too much time away from the schedule)
The callback function will be called during an interrupt! Do not call other API functions than io_getDigital or io_getPort in callback function. Do not switch the registerbank. Do not use overlaying and optimizing in callback function.
If you did not initialised callback function pointer and you enable callback function, then the interrupt occurs, but function cannot be called and interrupt returns without function. Program will not crash, but resources are used.
//define the callback function
void callback()
{
... // stay not too long
}
void yourFunction()
{
timer1_init(timer1_param, SET_ALL_PARAM); // initialise timer
timer1_initCB(&callback); // set pointer to callback function ?? Typcast (void*) ??? Report 7.11.08 FB
timer1_enableCB(TRUE); // enable callback
timer1_enable(TRUE); // start Timer1
.....
timer1_enableCB(FALSE); // temporary disable callback
.....
timer1_enableCB(TRUE); // and now enable callback
.....
timer1_enableCB(FALSE); // finally disable callback
timer1_enable(FALSE); // stop Timer1
}
See also:
timer1_initCB
void timer1_enable ( uint8  u8Enable)

Enables or disables function of timer1 (in both COUNTER and PWM mode)

Parameters:
[in]u8EnableTRUE, timer1 function enabled, FALSE, timer1 function disabled
Returns:
-
Note:
After enabling timer1 with timer_enable(TRUE) it will run in a loop until is stopped with timer_enable(FALSE)
This function is allowed to be used in an interrupt callback function ONLY if it is ensured that it is not used at the same time from the main program!
See also:
timer1_init
void timer1_getTimerCounter ( uint16 *  pu16Count)

Returns actual counter value

Parameters:
[out]*pu16CountPointer to store the counting value of timer1
Returns:
-
Note:
This function is allowed to be used in an interrupt callback function ONLY if it is ensured that it is not used at the same time from the main program!
void timer1_resetCounter ( )

Resets actual counter value

Parameters:
-
Returns:
-
Note:
This function is allowed to be used in an interrupt callback function ONLY if it is ensured that it is not used at the same time from the main program!