mikroSDK Reference Manual
hal_spi_master.h File Reference

Go to the source code of this file.

Data Structures

struct  hal_spi_master_handle_register_t
 SPI Master level handle. More...
 
struct  hal_spi_master_config_t
 HAL SPI Master init configuration structure, consisted of the following fields : More...
 
struct  hal_spi_master_t
 SPI master HAL context structure, consisted of the following fields : More...
 

Enumerations

enum  hal_spi_master_mode_t
 
enum  hal_spi_master_chip_select_polarity_t
 
enum  hal_spi_master_err_t
 

Functions

void hal_spi_master_configure_default (hal_spi_master_config_t *config)
 Configure SPI Master configuration structure with default values. More...
 
err_t hal_spi_master_open (handle_t *handle, bool hal_obj_open_state)
 Open the SPI Master HAL object on selected pins. More...
 
void hal_spi_master_select_device (hal_pin_name_t chip_select)
 Select SPI Slave device. More...
 
void hal_spi_master_deselect_device (hal_pin_name_t chip_select)
 Deselect SPI Slave device. More...
 
void hal_spi_master_set_chip_select_polarity (hal_spi_master_chip_select_polarity_t polarity)
 Set desired chip select polarity. More...
 
void hal_spi_master_set_default_write_data (handle_t *handle, hal_spi_master_config_t *config)
 Set SPI Master default ( dummy ) write data. More...
 
err_t hal_spi_master_set_speed (handle_t *handle, hal_spi_master_config_t *config)
 Set desired SPI communication speed. More...
 
err_t hal_spi_master_set_mode (handle_t *handle, hal_spi_master_config_t *config)
 Set desired SPI communication mode. More...
 
err_t hal_spi_master_write (handle_t handle, uint8_t *__generic_ptr write_data_buffer, size_t write_data_length)
 Write byte to SPI bus. More...
 
err_t hal_spi_master_read (handle_t handle, uint8_t *read_data_buffer, size_t read_data_length)
 Read byte from SPI bus. More...
 
err_t hal_spi_master_write_then_read (handle_t handle, 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 hal_spi_master_close (handle_t *handle)
 Close SPI Master HAL context object. More...
 

Enumeration Type Documentation

◆ hal_spi_master_mode_t

Enum containing predefined module mode values.

Enumerator
HAL_SPI_MASTER_MODE_0 

SPI MODE 0

HAL_SPI_MASTER_MODE_1 

SPI MODE 1

HAL_SPI_MASTER_MODE_2 

SPI MODE 2

HAL_SPI_MASTER_MODE_3 

SPI MODE 3

HAL_SPI_MASTER_MODE_DEFAULT 

Default SPI mode - MODE 0

◆ hal_spi_master_chip_select_polarity_t

Enum containing predefined chip select polarity values.

Enumerator
HAL_SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_LOW 

CS active low.

HAL_SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_HIGH 

CS active high.

HAL_SPI_MASTER_CHIP_SELECT_DEFAULT_POLARITY 

CS active low.

◆ hal_spi_master_err_t

Enum containing predefined module return values.

Enumerator
HAL_SPI_MASTER_SUCCESS 

Success.

HAL_SPI_MASTER_WRONG_PINS 

Wrong pins selected.

HAL_SPI_MASTER_MODULE_ERROR 

Object wasn't closed.

HAL_SPI_MASTER_ERROR 

Error.