1.28.25.12 TCx_CHy_ComparePeriodGet Function
C
/* x = TC instance number, y= channel number */ /* 16 bit counter */ uint16_t TCx_CHy_ComparePeriodGet ( void ) /* 32 bit counter */ uint32_t TCx_CHy_ComparePeriodGet ( void )
Summary
Gets the period value of given timer channel in compare mode.
Description
This function gets the current value of period of given timer channel in compare mode.
Precondition
TCx_CHy_CompareInitialize() function must have been called first for the given channel.
Parameters
None
Returns
The timer's period value. Type varies with the bit width of the counter.
Example
16 bit counter
uint16_t period; TC0_CH1_CompareInitialize(); period = TC0_CH1_ComparePeriodGet();
32 bit counter
uint32_t period; TC0_CH1_CompareInitialize(); period = TC0_CH1_ComparePeriodGet();
Remarks
The caller must know the number of significant bits of timer. Period value is right-aligned.