mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #2297 from neilt6/spi-mutex-fix
[HAL] Modified SPI to use shared mutexpull/2318/head
commit
ac34f29f66
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "PlatformMutex.h"
|
||||
#include "spi_api.h"
|
||||
#include "SingletonPtr.h"
|
||||
|
||||
#if DEVICE_SPI_ASYNCH
|
||||
#include "CThunk.h"
|
||||
|
@ -247,7 +248,7 @@ protected:
|
|||
|
||||
void aquire(void);
|
||||
static SPI *_owner;
|
||||
PlatformMutex _mutex;
|
||||
static SingletonPtr<PlatformMutex> _mutex;
|
||||
int _bits;
|
||||
int _mode;
|
||||
int _hz;
|
||||
|
|
|
@ -57,6 +57,7 @@ void SPI::frequency(int hz) {
|
|||
}
|
||||
|
||||
SPI* SPI::_owner = NULL;
|
||||
SingletonPtr<PlatformMutex> SPI::_mutex;
|
||||
|
||||
// ignore the fact there are multiple physical spis, and always update if it wasnt us last
|
||||
void SPI::aquire() {
|
||||
|
@ -78,11 +79,11 @@ int SPI::write(int value) {
|
|||
}
|
||||
|
||||
void SPI::lock() {
|
||||
_mutex.lock();
|
||||
_mutex->lock();
|
||||
}
|
||||
|
||||
void SPI::unlock() {
|
||||
_mutex.unlock();
|
||||
_mutex->unlock();
|
||||
}
|
||||
|
||||
#if DEVICE_SPI_ASYNCH
|
||||
|
|
Loading…
Reference in New Issue