How to use mutex in embedded C and Atmega 16?
问题 I am writting a C code for Atmega Microcontroller and I want to use Mutex in it. What library to include? and how to implement the code? I want this Mutex to prevent a Timer interrupt from changing a variable during a function. 回答1: If you are using an RTOS or threading library, it almost certainly includes a mutex API, and if you are not then you don't need a mutex. In any case you cannot use a mutex in an interrupt handler in any case. Instead, if your timer variable is modified in the