使用HAL库的API函数,最好不要同一个函数多个任务里面搞。
#if (USE_RTOS == 1)
#error " USE_RTOS should be 0 in the current HAL release "
#else
#define __HAL_LOCK(__HANDLE__)
do{
if((__HANDLE__)->Lock == HAL_LOCKED)
{
return HAL_BUSY;
}
else
{
(__HANDLE__)->Lock = HAL_LOCKED;
}
}while (0)
#define __HAL_UNLOCK(__HANDLE__)
do{
(__HANDLE__)->Lock = HAL_UNLOCKED;
}while (0)
#endif /* USE_RTOS */ |