#include </tmp/tmpjuwu__vz/stm32l072vzt6/modm-test/src/modm-test/mock/spi_master.hpp>
|
static void | initialize () |
|
static void | setDataMode (DataMode mode) |
|
static void | setDataOrder (DataOrder order) |
|
static uint8_t | acquire (void *ctx, ConfigurationHandler handler=nullptr) |
|
static uint8_t | release (void *ctx) |
|
static uint8_t | transferBlocking (uint8_t data) |
|
static void | transferBlocking (uint8_t *tx, uint8_t *rx, std::size_t length) |
|
static modm::ResumableResult< uint8_t > | transfer (uint8_t data) |
|
static modm::ResumableResult< void > | transfer (uint8_t *tx, uint8_t *rx, std::size_t length) |
|
static std::size_t | getTxBufferLength () |
|
static void | popTxBuffer (uint8_t *buf) |
|
static void | appendRxBuffer (uint8_t *data, std::size_t length) |
|
static void | clearBuffers () |
|
static void | acknowledgeInterruptFlag () |
|
template<uint64_t available, uint64_t requested, percent_t tolerance> |
static void | assertBaudrateInTolerance () |
|
template<double available, double requested, percent_t tolerance> |
static void | assertDurationInTolerance () |
|
static void | configurePurpose () |
| configures a peripheral for a specific purpose
|
|
template<class... Signals> |
static void | connect () |
|
static bool | getInterruptFlag () |
| Read an interrupt flag.
|
|
static void | getParameter () |
| returns a parameter
|
|
static void | initialize () |
| initializes the peripheral, must be called before use.
|
|
static void | setParameter () |
| sets a parameter
|
|
static modm::ResumableResult< void > | transfer (const uint8_t *tx, uint8_t *rx, std::size_t length) |
|
static void | transferBlocking (const uint8_t *tx, uint8_t *rx, std::size_t length) |
|
Mock serial peripheral interface for unittests.
- Author
- Raphael Lehmann
Spi Data Mode, Mode0 is the most common mode.
Enum Values | Documentation |
---|
Mode0 | clock normal, sample on rising edge
|
Mode1 | clock normal, sample on falling edge
|
Mode2 | clock inverted, sample on falling edge
|
Mode3 | clock inverted, sample on rising edge
|
static void modm::PeripheralDriver::acknowledgeInterruptFlag |
( |
| ) |
|
|
inheritedstatic |
Acknowledge an interrupt flag.
We use acknowledge here, since it describes the intention rather than the actual implementation.
template<uint64_t available, uint64_t requested, percent_t tolerance>
static void modm::PeripheralDriver::assertBaudrateInTolerance |
( |
| ) |
|
|
inheritedinlinestatic |
Since baudrates are usually generated by prescaling a system clock, only several distinct values can be generated. This method checks if the user requested baudrate is within error tolerance of the system achievable baudrate.
template<class... Signals>
static void modm::SpiMaster::connect |
( |
| ) |
|
|
inheritedstatic |
Connect GPIOs to the peripheral and configure them.
This configures the Sck, Mosi and Miso signals and connects them.
- Template Parameters
-
Signals | One Scl and one Mosi signal are required (one Miso signal is optional) and can be passed out-of-order. |
static modm::ResumableResult<void> modm::SpiMaster::transfer |
( |
const uint8_t * |
tx, |
|
|
uint8_t * |
rx, |
|
|
std::size_t |
length |
|
) |
| |
|
inheritedstatic |
Set the data buffers and length with options and starts a non-blocking transfer. This may be hardware accelerated (DMA or Interrupt), but not guaranteed.
You must call this inside a Protothread or Resumable using PT_CALL
or RF_CALL
respectively.
- Warning
- These methods differ from Resumables by lacking context protection! You must ensure that only one driver is accessing this resumable function by using
acquire(ctx)
and release(ctx)
.
- Parameters
-
[in] | tx | pointer to transmit buffer, set to nullptr to send dummy bytes |
[out] | rx | pointer to receive buffer, set to nullptr to discard received bytes |
| length | number of bytes to be shifted out |
static void modm::SpiMaster::transferBlocking |
( |
const uint8_t * |
tx, |
|
|
uint8_t * |
rx, |
|
|
std::size_t |
length |
|
) |
| |
|
inheritedstatic |
Set the data buffers and length with options and starts a transfer. This may be hardware accelerated (DMA or Interrupt), but not guaranteed.
- Parameters
-
[in] | tx | pointer to transmit buffer, set to nullptr to send dummy bytes |
[out] | rx | pointer to receive buffer, set to nullptr to discard received bytes |
| length | number of bytes to be shifted out |
The documentation for this class was generated from the following files:
- modm-test/src/modm-test/mock/spi_master.hpp
- spi_master.cpp