mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-07 07:41:36 +08:00
SPI: Support setting the lock mode
This commit is contained in:
@@ -77,6 +77,15 @@ protected:
|
|||||||
int irq = 0);
|
int irq = 0);
|
||||||
virtual ~SPI();
|
virtual ~SPI();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locking modes supported by the driver.
|
||||||
|
*/
|
||||||
|
enum LockMode {
|
||||||
|
LOCK_PREEMPTION, /**< the default; lock against all forms of preemption. */
|
||||||
|
LOCK_THREADS, /**< lock only against other threads, using SPI_LOCK */
|
||||||
|
LOCK_NONE /**< perform no locking, only safe if the bus is entirely private */
|
||||||
|
};
|
||||||
|
|
||||||
virtual int init();
|
virtual int init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,13 +126,14 @@ protected:
|
|||||||
void set_frequency(uint32_t frequency);
|
void set_frequency(uint32_t frequency);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locking modes supported by the driver.
|
* Set the SPI bus locking mode
|
||||||
|
*
|
||||||
|
* This set the SPI locking mode. For devices competing with NuttX SPI
|
||||||
|
* drivers on a bus the right lock mode is LOCK_THREADS.
|
||||||
|
*
|
||||||
|
* @param mode Locking mode
|
||||||
*/
|
*/
|
||||||
enum LockMode {
|
void set_lockmode(enum LockMode mode) { locking_mode = mode; }
|
||||||
LOCK_PREEMPTION, /**< the default; lock against all forms of preemption. */
|
|
||||||
LOCK_THREADS, /**< lock only against other threads, using SPI_LOCK */
|
|
||||||
LOCK_NONE /**< perform no locking, only safe if the bus is entirely private */
|
|
||||||
};
|
|
||||||
|
|
||||||
LockMode locking_mode; /**< selected locking mode */
|
LockMode locking_mode; /**< selected locking mode */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user