mikroSDK Reference Manual
spi_master_config_t Struct Reference

The SPI Master driver configuration structure. More...

Data Fields

uint8_t default_write_data
 
pin_name_t sck
 
pin_name_t miso
 
pin_name_t mosi
 
uint32_t speed
 
spi_master_mode_t mode
 

Detailed Description

The context structure for storing driver configuration. User shall define the values stored within.

Warning
The following example describes how to fill a spi_master_config_t structure. Take into consideration that different hardware might not have the same pins. Make sure to accommodate pin name based on your hardware specifics.

Example

// SPI Master configuration structure.
spi_master_config_t spi_master_config;
// Specify desired SPI Serial Clock pin.
spi_master_config.sck = MIKROBUS_1_SCK;
// Specify desired SPI Master-In Slave-Out pin.
spi_master_config.miso = MIKROBUS_1_MISO;
// Specify desired SPI Master-Out Slave-In pin.
spi_master_config.mosi = MIKROBUS_1_MOSI;
// Specify desired SPI transfer rate.
spi_master_config.speed = 100000;
// Specify desired SPI Mode.
spi_master_config.mode = SPI_MASTER_MODE_0;
// Specify SPI default write data.
spi_master_config.default_write_data = 0x00;

Field Documentation

◆ default_write_data

uint8_t spi_master_config_t::default_write_data

SPI Master default write data.

◆ sck

pin_name_t spi_master_config_t::sck

SCK pin name.

◆ miso

pin_name_t spi_master_config_t::miso

MISO pin name.

◆ mosi

pin_name_t spi_master_config_t::mosi

MOSI pin name.

◆ speed

uint32_t spi_master_config_t::speed

SPI transfer rate.

◆ mode

spi_master_mode_t spi_master_config_t::mode

SPI mode.

spi_master_config_t::default_write_data
uint8_t default_write_data
Definition: drv_spi_master.h:127
spi_master_config_t::mode
spi_master_mode_t mode
Definition: drv_spi_master.h:132
SPI_MASTER_MODE_0
Definition: drv_spi_master.h:71
spi_master_config_t::miso
pin_name_t miso
Definition: drv_spi_master.h:129
spi_master_config_t
The SPI Master driver configuration structure.
Definition: drv_spi_master.h:125
spi_master_config_t::speed
uint32_t speed
Definition: drv_spi_master.h:131
spi_master_config_t::sck
pin_name_t sck
Definition: drv_spi_master.h:128
spi_master_config_t::mosi
pin_name_t mosi
Definition: drv_spi_master.h:130