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.
Solved! Go to Solution.
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!
-----------------------------------------------------------------------------------------------------------------------
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!
-----------------------------------------------------------------------------------------------------------------------
Thanks, I did not know that.