1.2.11.4.1 SYS_TIME_Initialize Function
C
SYS_MODULE_OBJ SYS_TIME_Initialize ( const SYS_MODULE_INDEX index, const SYS_MODULE_INIT * const init );
Summary
Initializes the System Time module.
Description
This function initializes the instance of the System Time module.
Parameters
Param | Description |
---|---|
index | Index for the instance to be initialized |
init | Pointer to a data structure containing data necessary to initialize the module. |
Returns
If successful, returns a valid handle to an object. Otherwise, it returns SYS_MODULE_OBJ_INVALID.
Example
const SYS_TIME_PLIB_INTERFACE sysTimePlibAPI = {
.timerCallbackSet = (SYS_TIME_PLIB_CALLBACK_REGISTER)TC0_CH0_TimerCallbackRegister,
.timerCounterGet = (SYS_TIME_PLIB_COUNTER_GET)TC0_CH0_TimerCounterGet,
.timerPeriodSet = (SYS_TIME_PLIB_PERIOD_SET)TC0_CH0_TimerPeriodSet,
.timerFrequencyGet = (SYS_TIME_PLIB_FREQUENCY_GET)TC0_CH0_TimerFrequencyGet,
.timerCompareSet = (SYS_TIME_PLIB_COMPARE_SET)TC0_CH0_TimerCompareSet,
.timerStart = (SYS_TIME_PLIB_START)TC0_CH0_TimerStart,
.timerStop = (SYS_TIME_PLIB_STOP)TC0_CH0_TimerStop
};
const SYS_TIME_INIT sysTimeInitData =
{
.timePlib = &sysTimePlibAPI,
.hwTimerIntNum = TC0_CH0_IRQn,
};
SYS_MODULE_OBJ objSysTime;
objSysTime = SYS_TIME_Initialize(SYS_TIME_INDEX_0, (SYS_MODULE_INIT *)&sysTimeInitData);
if (objSysTime == SYS_MODULE_OBJ_INVALID)
{
// Handle error
}
Remarks
This routine should normally only be called once during system initialization.