zephyrproject-rtos / gsoc-2022-arduino-core

Arduino Core Zephyr Module (GSoC 2022 Project)
Apache License 2.0
44 stars 11 forks source link

Add micros() and millis() functions #37

Closed szczys closed 2 years ago

szczys commented 2 years ago

Wraps Zephyr kernel timing calls in Arduino API. This completes the Arduino Time functions.

DhruvaG2000 commented 2 years ago

Could we perhaps add a sample to demonstrate this? I'll add it if the consensus is yes.. Otherwise this LGTM Haven't got the chance to test it but it looks alright to me.

szczys commented 2 years ago

These are standard Arduino functions. I tested them by adding this inside the loop of blinky_arduino:

printk("micros: %ld", micros());
printk("millis: %ld", millis());

My feeling is that they don't really belong in the blinky sample. We could do a "kitchen sink" sample that demonstrates everything. Or maybe some type of test app for that purpose?

DhruvaG2000 commented 2 years ago

Or else I feel we shouldn't over do on the samples either, I think these are pretty simple and standard in the arduino docs and any user can just google it and get to know how it is used