Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the RTC update for the 1s periodic event #309

Open
Kampi opened this issue Jul 15, 2024 · 7 comments · May be fixed by #318
Open

Using the RTC update for the 1s periodic event #309

Kampi opened this issue Jul 15, 2024 · 7 comments · May be fixed by #318
Assignees
Labels
enhancement New feature or request

Comments

@Kampi
Copy link
Collaborator

Kampi commented Jul 15, 2024

Replace the timer for the 1s periodic callback with the RTC update function when using rev 5

image

@Kampi Kampi added the enhancement New feature or request label Jul 15, 2024
@Kampi Kampi self-assigned this Jul 15, 2024
@Kampi
Copy link
Collaborator Author

Kampi commented Jul 15, 2024

@jakkra maybe we can replace the 10 seconds timer too?

@jakkra
Copy link
Owner

jakkra commented Jul 15, 2024

@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.

@Kampi
Copy link
Collaborator Author

Kampi commented Jul 15, 2024

@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 :)

@Kampi
Copy link
Collaborator Author

Kampi commented Jul 15, 2024

@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
Copy link
Owner

jakkra commented Jul 15, 2024

@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.

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?

@Kampi
Copy link
Collaborator Author

Kampi commented Jul 15, 2024

@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.

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
Copy link
Owner

jakkra commented Jul 15, 2024

@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.

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 :/

@Kampi Kampi reopened this Jul 18, 2024
@Kampi Kampi linked a pull request Jul 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants