Replacing default IRQ Handler for FTM component

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Replacing default IRQ Handler for FTM component

186 次查看
lfisher51
Contributor II

I'm creating a project for a FRDM-KE02Z40M board and need to replace the default IRQ handler for FTM2 with my own.  When I add FTM2 device in the Components tab of the Peripherals perspective it brings in files named fsl_adapter_ftm.c and .h in the component folder.  fsl_adapter_ftm.c contains a function declartion named FTM2_IRQHandler and that conflicts with my declaration of a function with the same name. (build error: multiple definition of `FTM2_IRQHandler').  I can get it to build by deleting the declaration in fsl_adapter_ftm.c but I think there should be a way  to do this without modifying a SDK file.

I tried selecting a custom handler name in the component config but that didn't help even though my code at that point didn't include any reference to the original handler name (the name does show up in a declare generated during "Update Code" in the Peripherals perspective.

The handler in fsl_adapter_ftm.c appears to utilize a callback function but I couldn't figure out how to use that either and in any case I'd prefer to eliminate the generated handler completely and write my own.  What do I need to change to make this work without modifying the SDK generated files?

 

The attached zip file contains the entire project.

 

0 项奖励
回复
1 回复

152 次查看
XuZhang
NXP Employee
NXP Employee

hi,lfisher51

Thank you for your interest in NXP Semiconductor products and the opportunity to serve you, I will gladly help you with this.

I checked your project and it seems that only fsl_adapter_ftm.c does not fsl_adapter_ftm.h.

XuZhang_0-1722594705755.png

 

​I think fsl_adapter_timer.h is fsl_adapter_ftm.h in your project. If so, try modifying your code in the following ways.

XuZhang_1-1722594714489.png

 

Wish it helps you.

 

BR

Xu Zhang

0 项奖励
回复