Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

ModusToolbox™ General Forum Discussions

DevRyan
Level 1
Level 1
5 sign-ins First like given First question asked

Hi,

I am trying to make, For a long&short press button project using tact switch in the cyw920706 EVK.

I need to know the elapsed time like millies() function from Arduino.

In the Modustoolbox,  I wonder if there is a easier way to do this.

thanks for replying

0 Likes
1 Solution
Qi_Colin
Moderator
Moderator
Moderator
250 sign-ins 50 solutions authored 25 likes received

Hi @DevRyan :

According to the API description of millies(), it is generated by timer.

Reconfiguration of the microcontroller’s timers may result in inaccurate millis() readings. The "Arduino AVR Boards" and "Arduino megaAVR Boards" cores use Timer0 to generate millis(). The "Arduino ARM (32-bits) Boards" and "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" cores use the SysTick timer.

Therefore, I suggest you use timer API to achieve this function. 

Best Regards,

Colin

View solution in original post

1 Reply
Qi_Colin
Moderator
Moderator
Moderator
250 sign-ins 50 solutions authored 25 likes received

Hi @DevRyan :

According to the API description of millies(), it is generated by timer.

Reconfiguration of the microcontroller’s timers may result in inaccurate millis() readings. The "Arduino AVR Boards" and "Arduino megaAVR Boards" cores use Timer0 to generate millis(). The "Arduino ARM (32-bits) Boards" and "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" cores use the SysTick timer.

Therefore, I suggest you use timer API to achieve this function. 

Best Regards,

Colin