feilipu / Arduino_FreeRTOS_Library

A FreeRTOS Library for all Arduino ATmega Devices (Uno R3, Leonardo, Mega, etc).
MIT License
848 stars 204 forks source link

Support configuration of the scheduler tick source by client #119

Closed neboskreb closed 1 year ago

neboskreb commented 1 year ago

This PR offers better control over the scheduler tick sources while keeping full compatibility to the default setting of WDT 15ms. Those developers who use WDT tick source won't need to change anything.

Main point for externalizing the configuration and ISR function is that their implementation fully dependent on the nature of ticks source used. Giving full control over these functions to the app developer is better from the architectural standpoint, because he is the one who knows the concrete timing source used. Supporting all possible variations within Arduino_FreeRTOS would bloat the codebase and increase our burden of testing.

Long story short, Arduino_FreeRTOS expects the app developer to provide two functions: A) the initialization of their tick source, and B) the ISR handler for it.

Documentation how to do it and code example are provided.

PR tested on actual device Atmega2560 with Timer0 as tick source.

feilipu commented 1 year ago

Noted with thanks.

Finishing up something on Z80 currently, so will get to review this PR over the next weekend or so.