sipeed / Maixduino

Arduino port on Maix board ( k210 )
https://maixduino.sipeed.com
Other
214 stars 93 forks source link

hardware timer #23

Closed mzy2240 closed 5 years ago

mzy2240 commented 5 years ago

Do you mind to provide a high level hardware timer? Like the timer for the Teensy board and the zerotimer for the SAMD21/51 board, with callback and interrupt. If a lot of efforts are needed, an example of some work around is greatly appreciated as well. Thanks!

bitsk commented 5 years ago

We have provided the Ticker library, which is based on hardware timers. Can it meet your requirements? Here is an example https://github.com/sipeed/Maixduino/blob/master/libraries/Ticker/examples/Blinker/Blinker.ino

mzy2240 commented 5 years ago

Thanks! Looks like it is the one I need. Does it support microsecond interval btw?

mzy2240 commented 5 years ago

I just checked the source code and it seems like the microsecond interval is not supported, do you mind to add that function later? Thank you very much!

bitsk commented 5 years ago

Done.

mzy2240 commented 5 years ago

Just test it and it works! Thank you so much!