#pragma once #include #include #include class spi_lock : public boost::noncopyable { public: using sptr = std::shared_ptr; static sptr make(uint8_t spidev_index); spi_lock(uint8_t spidev_index); uint8_t get_spidev() const; private: const uint8_t spidev_index; // BasicLockable implementation for lock_guard mutable std::mutex spi_mutex; friend class std::lock_guard; void lock(); void unlock(); };