Open Kampi opened 1 month ago
@jakkra maybe we can replace the 10 seconds timer too?
@Kampi make sure both 1s and 10s are still executed in the system workqueue context. i.e. switch the delayed work to just a k_work when the RTC ISR happens.
Drawback of using it also for 10s, is that we still need to wake up every 1s, even if there are none listening on 1s. Lower accuracy on 10s is fine IMO.
@jakkra good point. We also can't use the alarm for this because we need the alarm for something like a stopwatch. So let's start with 1s first. I want to use a worker scheduling in the update callback to make sure that there is no difference. So it's the same scenario for all listeners as now.
Btw. the RTC callbacks are already handled in the worker context :)
@jakkra the question how to add this to the code. We can add only one update callback to the driver. So we need a bit of gluecode to handle more than one callback or I move the code from zsw_periodic_event
to zsw_clock
but I don´t like this solution because it splits up the code.
@jakkra the question how to add this to the code. We can add only one update callback to the driver. So we need a bit of gluecode to handle more than one callback or I move the code from
zsw_periodic_event
tozsw_clock
but I don´t like this solution because it splits up the code.
Just from the top of my head how about register the rtc callback in zsw_clock and then add a way to register a tick callback to zsw_clock? Which then zsw_periodic_event
uses?
@jakkra the question how to add this to the code. We can add only one update callback to the driver. So we need a bit of gluecode to handle more than one callback or I move the code from
zsw_periodic_event
tozsw_clock
but I don´t like this solution because it splits up the code.Just from the top of my head how about register the rtc callback in zsw_clock and then add a way to register a tick callback to zsw_clock? Which then
zsw_periodic_event
uses?
That´s what I mean with gluecode to add more than one callback :)
@jakkra the question how to add this to the code. We can add only one update callback to the driver. So we need a bit of gluecode to handle more than one callback or I move the code from
zsw_periodic_event
tozsw_clock
but I don´t like this solution because it splits up the code.Just from the top of my head how about register the rtc callback in zsw_clock and then add a way to register a tick callback to zsw_clock? Which then
zsw_periodic_event
uses?That´s what I mean with gluecode to add more than one callback :)
Don't have a better suggestion :/
Replace the timer for the 1s periodic callback with the RTC update function when using rev 5