Hi,
How can I implement a repetitive MQX task (i.e. every 1s) without using _timer components?
regards,
gaston
Solved! Go to Solution.
Hi Gaston,
I need a little more information about your application however an option is to have into a task an infinite loop with a _time_delay(xxx). Please check the below example, this task toggle the pin value every second.
void led3_task(uint32_t initial_data)
{
int value = 0;
LWGPIO_STRUCT led3;
printf("\n led3 task \n");
lwgpio_init(&led3, BSP_LED3, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_NOCHANGE)) ;
lwgpio_set_functionality(&led3, BSP_LED3_MUX_GPIO);
while (TRUE)
{
_time_delay(1000);
lwgpio_set_value(&led3, value); /* toggle pin value */
value = value^1;
}
}
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Gaston,
I need a little more information about your application however an option is to have into a task an infinite loop with a _time_delay(xxx). Please check the below example, this task toggle the pin value every second.
void led3_task(uint32_t initial_data)
{
int value = 0;
LWGPIO_STRUCT led3;
printf("\n led3 task \n");
lwgpio_init(&led3, BSP_LED3, LWGPIO_DIR_OUTPUT, LWGPIO_VALUE_NOCHANGE)) ;
lwgpio_set_functionality(&led3, BSP_LED3_MUX_GPIO);
while (TRUE)
{
_time_delay(1000);
lwgpio_set_value(&led3, value); /* toggle pin value */
value = value^1;
}
}
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Sol, this is exactly what I needed. Thanks!
regards,
gaston