mikroSDK Reference Manual
drv_spi_master.h File Reference

Go to the source code of this file.

Data Structures

struct  spi_master_config_t
 The SPI Master driver configuration structure. More...
 
struct  spi_master_t
 The SPI Master driver context structure. More...
 

Enumerations

enum  spi_master_err_t
 
enum  spi_master_mode_t
 
enum  spi_master_chip_select_polarity_t
 

Functions

void spi_master_configure_default (spi_master_config_t *config)
 Configure SPI Master configuration structure. More...
 
err_t spi_master_open (spi_master_t *obj, spi_master_config_t *config)
 Open the SPI Master driver object on selected pins. More...
 
void spi_master_select_device (pin_name_t chip_select)
 Select SPI Slave device. More...
 
void spi_master_deselect_device (pin_name_t chip_select)
 Deselect SPI Slave device. More...
 
void spi_master_set_chip_select_polarity (spi_master_chip_select_polarity_t polarity)
 Set desired SPI Master chip select polarity. More...
 
err_t spi_master_set_default_write_data (spi_master_t *obj, uint8_t default_write_data)
 Set SPI Master driver default ( dummy ) write data. More...
 
err_t spi_master_set_speed (spi_master_t *obj, uint32_t speed)
 Set SPI Master driver communication speed. More...
 
err_t spi_master_set_mode (spi_master_t *obj, spi_master_mode_t mode)
 Set SPI Master driver communication mode. More...
 
err_t spi_master_write (spi_master_t *obj, uint8_t *__generic_ptr write_data_buffer, size_t write_data_length)
 Write byte to SPI bus. More...
 
err_t spi_master_read (spi_master_t *obj, uint8_t *read_data_buffer, size_t read_data_length)
 Read byte from SPI bus. More...
 
err_t spi_master_write_then_read (spi_master_t *obj, uint8_t *write_data_buffer, size_t length_write_data, uint8_t *read_data_buffer, size_t length_read_data)
 Perform a sequence of SPI Master writes immediately followed by a SPI Master read. More...
 
err_t spi_master_close (spi_master_t *obj)
 Close SPI Master Driver context object. More...
 

Enumeration Type Documentation

◆ spi_master_err_t

Return values.

Enumerator
SPI_MASTER_SUCCESS 

Success.

SPI_MASTER_ERROR 

Error.

◆ spi_master_mode_t

Enum containing predefined module mode values.

Warning
Take into consideration that these modes may differ depending on the vendor.
Enumerator
SPI_MASTER_MODE_0 

SPI MODE 0.

SPI_MASTER_MODE_1 

SPI MODE 1.

SPI_MASTER_MODE_2 

SPI MODE 2.

SPI_MASTER_MODE_3 

SPI MODE 3.

SPI_MASTER_MODE_DEFAULT 

Default SPI mode - MODE 0.

◆ spi_master_chip_select_polarity_t

Enum containing predefined chip select polarity values.

Enumerator
SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_LOW 

Chip Select Polarity - Active Low. Chip Select Polarity - Active High.

SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_HIGH 

Chip Select Default Polarity - Active Low.