From 946fe5091cbb20d229e045b4a11329813142ca7f Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Sun, 25 Oct 2020 14:26:46 -0700 Subject: [PATCH] remove spiMtx (#1907) --- firmware/hw_layer/hardware.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 0dcc2a1508..3cfef24204 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -71,8 +71,6 @@ EXTERN_ENGINE; extern bool hasFirmwareErrorFlag; -static mutex_t spiMtx; - #if HAL_USE_SPI extern bool isSpiInitialized[5]; @@ -85,14 +83,12 @@ bool rtcWorks = true; * Only one consumer can use SPI bus at a given time */ void lockSpi(spi_device_e device) { - UNUSED(device); efiAssertVoid(CUSTOM_STACK_SPI, getCurrentRemainingStack() > 128, "lockSpi"); - // todo: different locks for different SPI devices! - chMtxLock(&spiMtx); + spiAcquireBus(getSpiDevice(device)); } void unlockSpi(spi_device_e device) { - chMtxUnlock(&spiMtx); + spiReleaseBus(getSpiDevice(device)); } static void initSpiModules(engine_configuration_s *engineConfiguration) { @@ -451,8 +447,6 @@ void initHardware(Logging *l) { // 10 extra seconds to re-flash the chip //flashProtect(); - chMtxObjectInit(&spiMtx); - #if EFI_HISTOGRAMS /** * histograms is a data structure for CPU monitor, it does not depend on configuration