Skip to content

feat: implemented callback for tick getting - #15

Merged
ale-giustina merged 1 commit into
devfrom
feat/tick_callback
Oct 8, 2026
Merged

ale-giustina merged 1 commit into
devfrom
feat/tick_callback

Conversation

@ale-giustina

Copy link
Copy Markdown
Contributor

Purpose

Implementation a callback for tick getting in the watchdog module

Overview

This pull request updates the watchdogs module API and its documentation to simplify time handling. The main change is that the watchdogs module now takes a tick getter function at initialization and reads the current tick itself, so most API functions no longer require a tick parameter. The documentation and examples are updated to reflect this change, and to clarify the correct usage of the new API.

API and Usage Simplification:

  • The watchdogs module now requires a tick getter function (uint32_t get_tick(void)) during initialization, and all time-dependent functions (such as start, pet, restart, reset, and routine) no longer take a tick parameter. The module calls the getter internally whenever it needs the current time. (README.md [1] [2] [3] [4]
  • The usage of watchdogs in the code and examples is updated: all calls to watchdog API functions are changed to remove the tick argument, and a tick getter function is provided in each example. (examples/watchdog-example.c [1] [2] [3] [4] [5] [6]; examples/watchdog-example-2.c [7] [8] [9] [10] [11] [12]

Documentation Improvements:

  • The README is updated to clarify how the tick getter works, the rationale behind the change, and the rules for implementing the getter function. The example code is also updated to match the new API. (README.md [1] [2] [3] [4]
  • The behavior of re-arming a timed-out watchdog is clarified: callbacks must use restart (or reset + start), not just start, to re-arm a timed-out watchdog. (README.md README.mdL189-R203)

Example Enhancements:

  • Both example files are revised to use the new tick getter approach, to zero-initialize watchdog structures, and to demonstrate correct usage of reset and restart operations. (examples/watchdog-example.c [1] [2] [3] [4] [5] [6]; examples/watchdog-example-2.c [7] [8] [9] [10] [11] [12]

These changes make the watchdogs module easier to use and integrate, especially in environments where the current tick is not always available.

partially closes #14

@ale-giustina ale-giustina self-assigned this Oct 8, 2026
@ale-giustina
ale-giustina merged commit 6d96c91 into dev Oct 8, 2026
2 checks passed
@ale-giustina
ale-giustina deleted the feat/tick_callback branch October 8, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant