diff options
Diffstat (limited to 'mpm/lib/spi/spi_lock.cpp')
-rw-r--r-- | mpm/lib/spi/spi_lock.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mpm/lib/spi/spi_lock.cpp b/mpm/lib/spi/spi_lock.cpp new file mode 100644 index 000000000..1796de46a --- /dev/null +++ b/mpm/lib/spi/spi_lock.cpp @@ -0,0 +1,26 @@ +#include "spi_lock.h" + +spi_lock::spi_lock(uint8_t spidev_index) : + spidev_index(spidev_index) +{ + +} + +uint8_t spi_lock::get_spidev() const +{ + return spidev_index; +} + +void spi_lock::lock() +{ + spi_mutex.lock(); +} +void spi_lock::unlock() +{ + spi_mutex.unlock(); +} + +spi_lock::sptr spi_lock::make(uint8_t spidev_index) +{ + return std::make_shared<spi_lock>(spidev_index); +}
\ No newline at end of file |