R_TMRDn_Get_PulseWidth


Reads the pulse width of the 16-bit timer RDn.

Remarks 1.

This API function can only be called when the 16-bit timer RDn is being used for input capture function.

Remarks 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_TMRDn_Get_PulseWidth ( uint32_t * const active_width, uint32_t * const inactive_width, timer_channel_t channel );

Remark

n is the channel number.

[Argument(s)]

I/O

Argument

Description

O

uint32_t
  * const active_width;

Pointer to an area storing the active level width that was read

O

uint32_t
  * const inactive_width;

Pointer to an area storing the inactive level width that was read

I

timer_channel_t channel;

Pin to read

TMCHANNELA: TRDIOAn pin

TMCHANNELB: TRDIOBn pin

TMCHANNELC: TRDIOCn pin

TMCHANNELD: TRDIODn pin

[Return value]

Macro

Description

MD_OK

Normal completion