Reads the pulse width of the 16-bit timer RG0.
Remark 1. This API function can only be called when the 16-bit timer RG0 is being used for input capture function.
Remark 2. If there is an overflow (2 pulses or more) during pulse-width measurement, then the pulse width will not be read correctly.
[Syntax]
#include r_cg_macrodriver.h
#include r_cg_timer.h
MD_STATUS
R_TMR_RJ0_Get_PulseWidth ( uint32_t * const active_width,
uint32_t *
const inactive_width, timer_channel_t channel );
[Argument(s)]
I/O |
Argument |
Description |
O |
unit32_t * const active_width; |
Pointer to an area storing the active level width that was read from the TRGIOA pin |
O |
uint32_t * const inactive_width; |
Pointer to an area storing the inactive level width that was read from the TRGIOA pin |
I |
timer_channel_t channel; |
Pin to read TMCHANNELA : TRGIOA0 pin TMCHANNELB : TRGIOB0 pin |
[Return value]
Macro |
Description |
MD_OK |
Normal completion |