hi, I want to create a clock to monitor time whenever i want. can anyone give me an idea how to create it?
hi, I want to create a clock to monitor time whenever i want. can anyone give me an idea how to create it?
Use RTCx HW peripheral to emulate "tick" and then convert it to human readable time whenever needed. Sure you need to synchronize the clock first and then correct periodically (but that depends on how precise you have LF clock source and how precise you want to be). There are simple examples how to work with RTC in nRF5 SDK examples and HW "driver" libraries but don't expect this exact code, you will need to write the logic yourself.
You indeed can use app_timer module from SDK as it's using RTC hardware underneath. You might get something smaller and even more optimized if you write it from scratch but it should work well when going with this lib. The main challenge will be precision (short term - because app_timer interrupts will probably run with low priority so you can experience up to several milliseconds jitter if you want to achieve sub-ms accuracy - and long term - because of natural drift of LF clock source).
You indeed can use app_timer module from SDK as it's using RTC hardware underneath. You might get something smaller and even more optimized if you write it from scratch but it should work well when going with this lib. The main challenge will be precision (short term - because app_timer interrupts will probably run with low priority so you can experience up to several milliseconds jitter if you want to achieve sub-ms accuracy - and long term - because of natural drift of LF clock source).