mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-29 22:23:06 +00:00
18 lines
381 B
C
18 lines
381 B
C
|
#include <api-hal-i2c.h>
|
||
|
#include <furi.h>
|
||
|
|
||
|
osMutexId_t api_hal_i2c_mutex = NULL;
|
||
|
|
||
|
void api_hal_i2c_init() {
|
||
|
api_hal_i2c_mutex = osMutexNew(NULL);
|
||
|
furi_check(api_hal_i2c_mutex);
|
||
|
}
|
||
|
|
||
|
void api_hal_i2c_lock() {
|
||
|
furi_check(osMutexAcquire(api_hal_i2c_mutex, osWaitForever) == osOK);
|
||
|
}
|
||
|
|
||
|
void api_hal_i2c_unlock() {
|
||
|
furi_check(osMutexRelease(api_hal_i2c_mutex) == osOK);
|
||
|
}
|