Proper hwtimer bsp definition

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

Proper hwtimer bsp definition

跳至解决方案
1,026 次查看
jamesmonczynski
Contributor II

I need to change hwtimer2 definition.

After creating my custom k70, the default is:

/* HWTIMER definitions for user applications */

#define BSP_HWTIMER1_DEV        pit_devif

#define BSP_HWTIMER1_SOURCE_CLK (CM_CLOCK_SOURCE_BUS)

#define BSP_HWTIMER1_ID         (0)

#define BSP_HWTIMER2_DEV      lpt_devif

#define BSP_HWTIMER2_SOURCE_CLK (CM_CLOCK_SOURCE_LPO)

#define BSP_HWTIMER2_ID         (0)

because I needed a pit timer, not an lpo, I changed it to:

/* HWTIMER definitions for user applications */

#define BSP_HWTIMER1_DEV        pit_devif

#define BSP_HWTIMER1_SOURCE_CLK (CM_CLOCK_SOURCE_BUS)

#define BSP_HWTIMER1_ID         (0)

#define BSP_HWTIMER2_DEV        pit_devif             //was lpt_devif

#define BSP_HWTIMER2_SOURCE_CLK (CM_CLOCK_SOURCE_BUS) //was (CM_CLOCK_SOURCE_LPO)

#define BSP_HWTIMER2_ID         (1)

I would like to know if this is the proper/standard way of updating the hwtimer definition?

Or, is there another way using the user_config.h to do the same (I couldn't find any setting for hwtimers).

Thanks for any info.

标记 (2)
0 项奖励
回复
1 解答
869 次查看
RadekS
NXP Employee
NXP Employee

Yes, you can use definitions in twrk70f120m.h file for initialization your own application timer.

On other hand, this definitions are not necessary - they are there just for standardization of hwtimer example code across MCUs portfolio. You can define these values directly in your code or use directly numbers in hwtimer_init() function.

For example:

HWTIMER hwtimer5;

/* Initialize  hwtimer5 */

result = hwtimer_init(&hwtimer5, &pit_devif, 5, 3);

if (MQX_OK != result)

{

    return result;

}


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
2 回复数
870 次查看
RadekS
NXP Employee
NXP Employee

Yes, you can use definitions in twrk70f120m.h file for initialization your own application timer.

On other hand, this definitions are not necessary - they are there just for standardization of hwtimer example code across MCUs portfolio. You can define these values directly in your code or use directly numbers in hwtimer_init() function.

For example:

HWTIMER hwtimer5;

/* Initialize  hwtimer5 */

result = hwtimer_init(&hwtimer5, &pit_devif, 5, 3);

if (MQX_OK != result)

{

    return result;

}


Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
869 次查看
jamesmonczynski
Contributor II

Thanks, I did not know that.

0 项奖励
回复