Hi,
1) no, you have no direct info which edge causes an event, assuming operation mode "detect both edges" is selected. You can try to read channel input state (CHIS bit) and determine based on this. But this could not be valid info, depends when read.
2) IC_GetMeasurement returns captured value of FTM counter at the time edge happens, if edge detect mode is selected ( rising, falling or both edges) or difference of 2 captured value if signal measurement mode is selected (period between 2 rising/falling edges or duty cycle ON/OFF).
Thus could be easy to use one of signal measurement mode or better 2 of them to get period and duty cycle.
To measure period:
- select mode "period between 2 rising (or falling) edges"
- get the FTM frequency to calculate the frequency of the measured signal.
ftm_frequency = FTM_DRV_GetFrequency
- get captured period_count = IC_GetMeasurement
- then signal frequency = ftm_frequency / period_count
To measure duty:
- select mode "duty cycle ON (OFF)"
- get captured duty_count = IC_GetMeasurement
- then signal duty = duty_count / period_count * 100
BR, Petr