Loading...
Searching...
No Matches
cpu_spi.h File Reference

SPI CPU specific definitions for the STM32 family. More...

Detailed Description

SPI CPU specific definitions for the STM32 family.

Author
Hauke Petersen hauke.nosp@m..pet.nosp@m.ersen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de
Vincent Dupont vince.nosp@m.nt@o.nosp@m.takey.nosp@m.s.co.nosp@m.m

Definition in file cpu_spi.h.

#include <stdint.h>
#include "cpu.h"
#include "macros/units.h"
#include "periph/cpu_dma.h"
#include "periph/cpu_gpio.h"
+ Include dependency graph for cpu_spi.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  spi_conf_t
 SPI device configuration. More...
 
#define SPI_HWCS_MASK   (0xffffff00)
 Define a magic number that tells us to use hardware chip select.
 
#define SPI_HWCS(x)   (SPI_HWCS_MASK | x)
 Override the default SPI hardware chip select access macro.
 
#define SPI_CS_UNDEF   (GPIO_UNDEF)
 Define value for unused CS line.
 
#define PERIPH_SPI_NEEDS_TRANSFER_BYTE
 Use the shared SPI functions.
 
#define PERIPH_SPI_NEEDS_TRANSFER_REG
 Use transfer reg function from periph common.
 
#define PERIPH_SPI_NEEDS_TRANSFER_REGS
 Use transfer regs function from periph common.
 
#define HAVE_SPI_CLK_T
 Override SPI clock speed values.
 
enum  {
  SPI_CLK_100KHZ = KHZ(100) , SPI_CLK_400KHZ = KHZ(400) , SPI_CLK_1MHZ = MHZ(1) , SPI_CLK_5MHZ = MHZ(5) ,
  SPI_CLK_10MHZ = MHZ(10)
}
 
typedef uint32_t spi_clk_t
 SPI clock type.
 

Macro Definition Documentation

◆ HAVE_SPI_CLK_T

#define HAVE_SPI_CLK_T

Override SPI clock speed values.

Definition at line 88 of file cpu_spi.h.

◆ PERIPH_SPI_NEEDS_TRANSFER_BYTE

#define PERIPH_SPI_NEEDS_TRANSFER_BYTE

Use the shared SPI functions.

Use transfer byte function from periph common

Definition at line 77 of file cpu_spi.h.

◆ PERIPH_SPI_NEEDS_TRANSFER_REG

#define PERIPH_SPI_NEEDS_TRANSFER_REG

Use transfer reg function from periph common.

Definition at line 79 of file cpu_spi.h.

◆ PERIPH_SPI_NEEDS_TRANSFER_REGS

#define PERIPH_SPI_NEEDS_TRANSFER_REGS

Use transfer regs function from periph common.

Definition at line 81 of file cpu_spi.h.

◆ SPI_CS_UNDEF

#define SPI_CS_UNDEF   (GPIO_UNDEF)

Define value for unused CS line.

Definition at line 60 of file cpu_spi.h.

◆ SPI_HWCS

#define SPI_HWCS (   x)    (SPI_HWCS_MASK | x)

Override the default SPI hardware chip select access macro.

Since the CPU does only support one single hardware chip select line, we can detect the usage of non-valid lines by comparing to SPI_HWCS_VALID.

Definition at line 55 of file cpu_spi.h.

◆ SPI_HWCS_MASK

#define SPI_HWCS_MASK   (0xffffff00)

Define a magic number that tells us to use hardware chip select.

We use a random value here, that does clearly differentiate from any possible GPIO_PIN(x) value.

Definition at line 47 of file cpu_spi.h.

Typedef Documentation

◆ spi_clk_t

typedef uint32_t spi_clk_t

SPI clock type.

Definition at line 100 of file cpu_spi.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SPI_CLK_100KHZ 

drive the SPI bus with 100KHz

SPI_CLK_400KHZ 

drive the SPI bus with 400KHz

SPI_CLK_1MHZ 

drive the SPI bus with 1MHz

SPI_CLK_5MHZ 

drive the SPI bus with 5MHz

SPI_CLK_10MHZ 

drive the SPI bus with 10MHz

Definition at line 89 of file cpu_spi.h.