Skip to content

feat: implemented callback for tick getting in tasks module - #16

Merged
ale-giustina merged 2 commits into
devfrom
feat/task_tick_callback
Oct 8, 2026
Merged

ale-giustina merged 2 commits into
devfrom
feat/task_tick_callback

Conversation

@ale-giustina

Copy link
Copy Markdown
Contributor

Purpose

Add callback to the tasks module to get the tick

Overview

This pull request refactors the tasks API to remove the need for passing the current tick as a parameter to most functions. Instead, the tasks and watchdogs modules now use a user-provided tick getter function, which they call internally whenever they need the current time. This change simplifies the API, makes it easier to use in environments where the current tick isn't always available, and aligns the tasks and watchdogs modules with a consistent approach to time handling. The documentation and example code have been updated to reflect these changes.

API and Usage Refactor:

  • The tasks module now receives a tick getter function (uint32_t get_tick(void)) during initialization, which it uses to obtain the current tick internally; all API functions that previously required a current_tick parameter no longer take it. (README.md, examples/tasks-example.c) [1] [2] [3] [4] [5] [6] [7]

  • All example code and documentation have been updated to demonstrate the new API, including changes to function signatures and usage patterns in examples/tasks-example.c and the main setup loop in the README.md. [1] [2] [3] [4] [5] [6]

Documentation Improvements:

  • The README now includes a dedicated section explaining the tick getter concept, its requirements, and usage notes, as well as updated descriptions for all relevant API functions and behaviors. (README.md) [1] [2]

  • All references to time handling, scheduling, and temporal discontinuity in the tasks and watchdogs modules have been revised to clarify that the tick is obtained via the getter function, and to explain the implications for API calls and callbacks. (README.md) [1] [2] [3]

Testing and CI:

  • Added a new CI job to build and test the new unified-example.c example, ensuring coverage for the updated API. (.github/workflows/main.yml)

closes #14

@ale-giustina
ale-giustina merged commit c44b804 into dev Oct 8, 2026
2 checks passed
@ale-giustina
ale-giustina deleted the feat/task_tick_callback branch October 8, 2026 17:41
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