12 #ifndef INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_SPIMASTER_HPP_ 13 #define INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_SPIMASTER_HPP_ 29 class SpiMasterLowLevel;
50 mutex_{Mutex::Type::recursive, Mutex::Protocol::priorityInheritance},
94 void configure(
SpiMode mode, uint32_t clockFrequency, uint8_t wordLength,
bool lsbFirst,
95 uint32_t dummyData)
const;
198 #endif // INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_SPIMASTER_HPP_ Definition: SpiMasterBase.hpp:28
void unlock()
Unlocks SPI master which was previously locked by current thread.
Definition: SpiMaster.cpp:141
Semaphore is the basic synchronization primitive.
Definition: Semaphore.hpp:30
~SpiMaster() override
SpiMaster's destructor.
Definition: SpiMaster.cpp:38
void lock()
Locks SPI master for exclusive use by current thread.
Definition: SpiMaster.cpp:92
void transferCompleteEvent(bool success) override
"Transfer complete" event
Definition: SpiMaster.cpp:121
SpiMode enum class header.
SpiMasterLowLevel & spiMaster_
reference to low-level implementation of SpiMasterLowLevel interface
Definition: SpiMaster.hpp:185
Mutex mutex_
mutex used to serialize access to this object
Definition: SpiMaster.hpp:176
void notifyWaiter(bool success)
Notifies waiting thread about completion of transaction.
Definition: SpiMaster.cpp:98
SpiMasterTransfersRange transfersRange_
range of transfers that are part of currently handled transaction
Definition: SpiMaster.hpp:179
SpiMode
Definition: SpiMode.hpp:29
void close()
Closes SPI master.
Definition: SpiMaster.cpp:47
estd::ContiguousRange< const SpiMasterTransfer > SpiMasterTransfersRange
Definition: SpiMasterTransfersRange.hpp:31
Definition: SpiMasterLowLevel.hpp:33
SpiMasterBase class header.
Top-level namespace of distortos project.
Definition: buttons.hpp:33
Semaphore *volatile semaphore_
pointer to semaphore used to notify waiting thread about completion of transaction
Definition: SpiMaster.hpp:182
volatile bool success_
tells whether the transaction was successful (true) or not (false)
Definition: SpiMaster.hpp:191
Mutex is the basic synchronization primitive.
Definition: Mutex.hpp:30
Definition: SpiMaster.hpp:37
int executeTransaction(SpiMasterTransfersRange transfersRange)
Executes series of transfers as a single atomic transaction.
Definition: SpiMaster.cpp:65
Definition: SpiMasterHandle.hpp:32
void configure(SpiMode mode, uint32_t clockFrequency, uint8_t wordLength, bool lsbFirst, uint32_t dummyData) const
Configures parameters of SPI master.
Definition: SpiMaster.cpp:57
constexpr SpiMaster(SpiMasterLowLevel &spiMaster)
SpiMaster's constructor.
Definition: SpiMaster.hpp:49
SpiMasterTransfersRange type alias header.
uint8_t openCount_
number of times this device was opened but not yet closed
Definition: SpiMaster.hpp:188
int open()
Opens SPI master.
Definition: SpiMaster.cpp:106