Open nfbot opened 7 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@josesimoes this has been done as far as I remember. If yes, please close it, so we can get things clean. Thanks!
Actually no... this is still work to be done....
From nf-interpreter created by josesimoes : nanoframework/nf-interpreter#159
In .NET world a point in time is represented with a DateTimeOffset Structure which has a time component measured in 100-nanosecond units.
The native part of nanoFramework is based on CMSIS whose time base is provided by SysTick that is platform and implementation dependent.
For embedded systems it doesn't make sense to waste resources with timekeeping and time management in nanoseconds (requires using timers larger than 32 bits, using 64 bits vars, use 64 bits math, etc).
The HAL functions have to be revisited and reworked to achieve compatibility between the two worlds. At the same time it should be made perfectly clear when a .NET tick is being used/required and when a CMSIS tick is being used/required. This will require renaming of function/arguments/vars.
HAL functions that are "internal" to the code should use the CMSIS ticks (to be resource wise).
HAL functions that are used by .NET API should use the .NET ticks. If a conversion between ticks is required (at platform level) the CMSIS functions are to be used in order to find out what is the frequency and tick real time value for correct calculations.