Proper hwtimer bsp definition

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Proper hwtimer bsp definition

Jump to solution
1,029 Views
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.

Tags (2)
0 Kudos
Reply
1 Solution
872 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
2 Replies
873 Views
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 Kudos
Reply
872 Views
jamesmonczynski
Contributor II

Thanks, I did not know that.

0 Kudos
Reply