Hardware Timer

COM8COM8
Posts: 4
Joined: Thu Sep 06, 2018 1:56 pm

Hardware Timer

Postby COM8COM8 » Sat Sep 08, 2018 3:16 pm

Hi,
I'm using esp-idf and would like to create a simple timer with the following properties:
* Should run for 1sec
* Should not generate interrupts
* I will check periodically if the timer has finished
* I'd like to use a hardware timer if possible
* If the timer finished and I check for it I will restart it manually

I've started looking around and tinkering with the example over on GitHub but I was not able to produce anything working.

Does somebody know an example matching my needs?

ESP_Sprite
Posts: 9724
Joined: Thu Nov 26, 2015 4:08 am

Re: Hardware Timer

Postby ESP_Sprite » Sun Sep 09, 2018 3:02 am

What is your use case? Depending on the need for precision, you may not even need a timer but can just check esp_timer_get_time() and wait until the result is 1e6 higher than when you first checked it.

COM8COM8
Posts: 4
Joined: Thu Sep 06, 2018 1:56 pm

Re: Hardware Timer

Postby COM8COM8 » Sun Sep 09, 2018 7:15 am

Yes, using esp_timer_get_time() is a great solution.
Thanks!

Who is online

Users browsing this forum: Bing [Bot] and 116 guests