44 #ifndef _HAL_SPI_MASTER_H_
45 #define _HAL_SPI_MASTER_H_
437 uint8_t *write_data_buffer,
438 size_t length_write_data,
439 uint8_t *read_data_buffer,
440 size_t length_read_data);
err_t hal_spi_master_close(handle_t *handle)
Close SPI Master HAL context object.
Definition: hal_spi_master.c:290
void hal_spi_master_select_device(hal_pin_name_t chip_select)
Select SPI Slave device.
Definition: hal_spi_master.c:156
err_t hal_spi_master_set_mode(handle_t *handle, hal_spi_master_config_t *config)
Set desired SPI communication mode.
Definition: hal_spi_master.c:353
void hal_spi_master_set_default_write_data(handle_t *handle, hal_spi_master_config_t *config)
Set SPI Master default ( dummy ) write data.
Definition: hal_spi_master.c:196
err_t hal_spi_master_write(handle_t handle, uint8_t *write_data_buffer, size_t write_data_length)
Write byte to SPI bus.
Definition: hal_spi_master.c:206
err_t hal_spi_master_set_speed(handle_t *handle, hal_spi_master_config_t *config)
Set desired SPI communication speed.
Definition: hal_spi_master.c:328
err_t hal_spi_master_open(handle_t *handle, bool hal_obj_open_state)
Open the SPI Master HAL object on selected pins.
Definition: hal_spi_master.c:98
err_t hal_spi_master_read(handle_t handle, uint8_t *read_data_buffer, size_t read_data_length)
Read byte from SPI bus.
Definition: hal_spi_master.c:242
void hal_spi_master_deselect_device(hal_pin_name_t chip_select)
Deselect SPI Slave device.
Definition: hal_spi_master.c:176
void hal_spi_master_set_chip_select_polarity(hal_spi_master_chip_select_polarity_t polarity)
Set desired chip select polarity.
Definition: hal_spi_master.c:316
void hal_spi_master_configure_default(hal_spi_master_config_t *config)
Configure SPI Master configuration structure with default values.
Definition: hal_spi_master.c:146
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.
Definition: hal_spi_master.c:263
This file contains all the functions prototypes for the GPIO library.
hal_spi_master_mode_t
Definition: hal_spi_master.h:73
@ HAL_SPI_MASTER_MODE_0
SPI MODE 0.
Definition: hal_spi_master.h:74
@ HAL_SPI_MASTER_MODE_1
SPI MODE 1.
Definition: hal_spi_master.h:75
@ HAL_SPI_MASTER_MODE_2
SPI MODE 2.
Definition: hal_spi_master.h:76
@ HAL_SPI_MASTER_MODE_3
SPI MODE 3.
Definition: hal_spi_master.h:77
@ HAL_SPI_MASTER_MODE_DEFAULT
Default SPI mode - MODE 0.
Definition: hal_spi_master.h:79
hal_spi_master_err_t
Definition: hal_spi_master.h:154
@ HAL_SPI_MASTER_MODULE_ERROR
Object wasn't closed.
Definition: hal_spi_master.h:157
@ HAL_SPI_MASTER_SUCCESS
Success.
Definition: hal_spi_master.h:155
@ HAL_SPI_MASTER_ERROR
Error.
Definition: hal_spi_master.h:158
@ HAL_SPI_MASTER_WRONG_PINS
Wrong pins selected.
Definition: hal_spi_master.h:156
hal_spi_master_chip_select_polarity_t
Definition: hal_spi_master.h:86
@ HAL_SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_HIGH
CS active high.
Definition: hal_spi_master.h:88
@ HAL_SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_LOW
CS active low.
Definition: hal_spi_master.h:87
@ HAL_SPI_MASTER_CHIP_SELECT_DEFAULT_POLARITY
CS active low.
Definition: hal_spi_master.h:89
HAL target macros and typedefs.
uintptr_t handle_t
Definition: hal_target.h:58
int32_t err_t
General error type.
Definition: hal_target.h:77
hal_ll_pin_name_t hal_pin_name_t
Pin type, which is size dependant on the architecture.
Definition: hal_target.h:73
HAL SPI Master init configuration structure, consisted of the following fields :
Definition: hal_spi_master.h:122
uint32_t speed
SPI transfer rate.
Definition: hal_spi_master.h:127
uint8_t default_write_data
SPI Master default write data.
Definition: hal_spi_master.h:123
hal_pin_name_t mosi
MOSI pin name.
Definition: hal_spi_master.h:126
hal_pin_name_t sck
SCK pin name.
Definition: hal_spi_master.h:124
hal_pin_name_t miso
MISO pin name.
Definition: hal_spi_master.h:125
hal_spi_master_mode_t mode
SPI mode.
Definition: hal_spi_master.h:128
SPI Master level handle.
Definition: hal_spi_master.h:63
handle_t * hal_spi_master_handle
SPI Master HAL level handle.
Definition: hal_spi_master.h:64
handle_t * drv_spi_master_handle
SPI Master DRV level handle.
Definition: hal_spi_master.h:65
bool init_state
SPI Master HAL object init state.
Definition: hal_spi_master.h:66
SPI master HAL context structure, consisted of the following fields :
Definition: hal_spi_master.h:145
hal_spi_master_config_t config
HAL SPI configuration structure.
Definition: hal_spi_master.h:147
handle_t handle
HAL SPI Master handle.
Definition: hal_spi_master.h:146