Skip to content
Snippets Groups Projects
Commit 52b617b6 authored by Matteo Pignataro's avatar Matteo Pignataro
Browse files

[VN100] Better time sleep method

parent 08190f13
Branches
Tags
No related merge requests found
......@@ -128,12 +128,14 @@ void VN100::run()
{
while (!shouldStop())
{
long long initialTime = miosix::getTick();
// Sample the data locking the mutex
miosix::Lock<FastMutex> l(mutex);
threadSample = sampleData();
// Sleep for the sampling period
miosix::Thread::sleep(samplePeriod);
miosix::Thread::sleepUntil(initialTime + samplePeriod);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment