modm API documentation
modm::platform::SpiMaster3_Dma< DmaChannelRx, DmaChannelTx > Class Template Reference

#include <modm/platform/spi/spi_master_3_dma.hpp>

Inheritance diagram for modm::platform::SpiMaster3_Dma< DmaChannelRx, DmaChannelTx >:
modm::platform::SpiMaster3 modm::SpiMaster modm::PeripheralDriver modm::Spi

Public Typedefs

using ConfigurationHandler = void (*)()
 The signature of the configuration function.
 
using DataSize = Hal::DataSize
 
using Hal = SpiHal3
 

Public Types

enum  DataMode : uint32_t { DataMode::Mode0 = 0b00, DataMode::Mode1 = SPI_CR1_CPHA, DataMode::Mode2 = SPI_CR1_CPOL, DataMode::Mode3 = SPI_CR1_CPOL | SPI_CR1_CPHA }
 Spi Data Mode, Mode0 is the most common mode. More...
 
enum  DataOrder : uint32_t { MsbFirst = 0b0, LsbFirst = SPI_CR1_LSBFIRST }
 Spi Data Order, MsbFirst is the most common mode.
 

Static Public Member Functions

template<class SystemClock , baudrate_t baudrate, percent_t tolerance = pct(5)>
static void initialize ()
 
static uint8_t transferBlocking (uint8_t data)
 
static void transferBlocking (const uint8_t *tx, uint8_t *rx, std::size_t length)
 
static modm::ResumableResult< uint8_t > transfer (uint8_t data)
 
static modm::ResumableResult< void > transfer (const uint8_t *tx, uint8_t *rx, std::size_t length)
 
static void acknowledgeInterruptFlag ()
 
static uint8_t acquire (void *ctx, ConfigurationHandler handler=nullptr)
 
template<baudrate_t available, baudrate_t requested, percent_t tolerance>
static void assertBaudrateInTolerance ()
 
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 uint8_t release (void *ctx)
 
static void setDataMode (DataMode mode)
 
static void setDataMode (DataMode mode)
 Sets a new data mode.
 
static void setDataOrder (DataOrder order)
 
static void setDataOrder (DataOrder order)
 Sets a new data order.
 
static void setDataSize (DataSize size)
 
static void setParameter ()
 sets a parameter
 

Static Protected Attributes

static uint8_t state {0}
 

Detailed Description

template<class DmaChannelRx, class DmaChannelTx>
class modm::platform::SpiMaster3_Dma< DmaChannelRx, DmaChannelTx >

Serial peripheral interface (SPI3) with DMA support.

This class uses the DMA controller for sending and receiving data, which greatly reduces the CPU load. Beside passing the DMA channels as template parameters the class can be used in the same way like the SpiMaster3.

Template Parameters
DmaChannelRXDMA channel for receiving
DmaChannelTXDMA channel for sending
Author
Mike Wolfram

Member Enumeration Documentation

enum modm::platform::SpiMaster3::DataMode : uint32_t
inheritedstrong

Spi Data Mode, Mode0 is the most common mode.

Enum ValuesDocumentation
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

Member Function Documentation

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<baudrate_t available, baudrate_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 DmaChannelRx , class DmaChannelTx >
template<class SystemClock , baudrate_t baudrate, percent_t tolerance = pct(5)>
static void modm::platform::SpiMaster3_Dma< DmaChannelRx, DmaChannelTx >::initialize ( )
static

Initialize DMA and SPI3


The documentation for this class was generated from the following file: