Hi,
Is there something like windows critical section within SDK 2.0 (or a mutex/semaphore will do). I am not using any RTOS. Basically there is a function which I do not want the system to interrupt, to service anything else. I am using SDK 2.0 for KL43.
The problem is the function shares a variable with uart callback function. So if there is a uart callback while the function is being services, the call back function changes the value and if my function is half way through processing based on initial value, when it resumes it goes crazy!
Many Thanks,
Tony
Solved! Go to Solution.
atomic.h attached gives the needed code.
ATOMIC_BLOCK( ATOMIC_RESTORESTATE )
{
// protected stuff.
}
Thank you very much :smileyhappy:.