Not sure if this is a bug or intended operation...
If I call the SelectCaptureEdge() method with an edge setting other than what I entered under Properties -> Event -> Edge, and then I call the Enable() method, the edge setting reverts to what I put under Properties -> Event -> Edge rather than staying what I set in SelectCaptureEdge().
For now, I changed this:
LDD_TError CapIR38_SelectCaptureEdge(LDD_TDeviceData *DeviceDataPtr, LDD_TimerUnit_TEdge Edge)
{
CapIR38_TDeviceData *DeviceDataPrv = (CapIR38_TDeviceData *)DeviceDataPtr;
return TU0_SelectCaptureEdge(DeviceDataPrv->LinkedDeviceDataPtr, CHANNEL, Edge);
}
to this:
LDD_TError CapIR38_SelectCaptureEdge(LDD_TDeviceData *DeviceDataPtr, LDD_TimerUnit_TEdge Edge)
{
CapIR38_TDeviceData *DeviceDataPrv = (CapIR38_TDeviceData *)DeviceDataPtr;
DeviceDataPrv->Edge = Edge;
return TU0_SelectCaptureEdge(DeviceDataPrv->LinkedDeviceDataPtr, CHANNEL, Edge);
}
And turned off automatic updates for this component.
Is this a bug or "as designed"?
Hello Doug,
I have the same problem with the KL25Z. I set in Properties -> Event -> Edge, for exemple 'rising edge', and I want to change it with the function SelectCaptureEdge during the execution of my code.
Buit seems that SelectCaptureEdge doesn't work, I can't catch the falling edge even I use Cap1_SelectCaptureEdge(Cap1DeviceData,EDGE_BOTH);or Cap1_SelectCaptureEdge(Cap1DeviceData,EDGE_FALLING). I tried to add DeviceDataPrv->Edge = Edge; as u have used, but it didn't change anything neither.
So I'd like to ask if you have solved your problem. I'm very interested if you did.
Thanks a lot !
Hello,
I have answered your question in the discussion thread Re: Capture_LDD SelectCaptureEdge
Best Regards,
Marek Neuzil
Hello Doug,
I have analyzed the source code and it seems that the DeviceDataPrv->Edge is not used by the driver (MK64FN1M0, FTM device used). There are several variants of the driver for devices across all CPU families but the Capter_LDD API is static. Therefore, for example, the FTM device variant of this driver do not use the Edge of the Capture_LDD TDeviceData structure.
You can freeze the generate code of the Capture_LDD driver (in the Components window, open the context menu of the Capture_LDD component and select Code Generation > Don't write Generated Component Modules) and modify the generated code (e.g. do optimizations).
Best Regards,
Marek Neuzil