A way to use millies() from arduino in ModusToolbox? I want to implement long press key using cyw920706

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

cross mob
DevRyan
Level 2
Level 2
25 sign-ins 5 likes given 5 replies posted

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
50 likes received 100 solutions authored 5 questions asked

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
50 likes received 100 solutions authored 5 questions asked

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