what is the best way to do a atomic uint32_t operation. The uint32_t variable is only accessed by different freertos tasks, not by HW-ISR.
I do not know if the stdatomic.h stuff works.
I tried
Code: Select all
uint32_t Can_ModifyUInt(uint32_t volatile *pUInt, uint32_t CompareValue, uint32_t NewValue)
{
taskDISABLE_INTERRUPTS();
uint32_t result = *pUInt;
if (result == CompareValue)
*pUInt = NewValue;
taskENABLE_INTERRUPTS();
return result;
}
Any help is appreciated,
Mark