File tree 2 files changed +4
-0
lines changed
2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -81,9 +81,11 @@ void arduino::MbedSPI::beginTransaction(SPISettings settings) {
81
81
dev->obj ->frequency (settings.getClockFreq ());
82
82
this ->settings = settings;
83
83
}
84
+ spiLockMutex.lock ();
84
85
}
85
86
86
87
void arduino::MbedSPI::endTransaction (void ) {
88
+ spiLockMutex.unlock ();
87
89
// spinlock until transmission is over (if using ASYNC transfer)
88
90
}
89
91
Original file line number Diff line number Diff line change 20
20
21
21
#include " Arduino.h"
22
22
#include " api/HardwareSPI.h"
23
+ #include < Mutex.h>
23
24
24
25
typedef struct _mbed_spi mbed_spi;
25
26
@@ -50,6 +51,7 @@ class MbedSPI : public SPIClass
50
51
private:
51
52
SPISettings settings = SPISettings(0 , MSBFIRST, SPI_MODE0);
52
53
_mbed_spi* dev = NULL ;
54
+ rtos::Mutex spiLockMutex;
53
55
PinName _miso;
54
56
PinName _mosi;
55
57
PinName _sck;
You can’t perform that action at this time.
0 commit comments