Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
hal_spi_master.c File Reference

SPI Master HAL layer implementation. More...

#include "hal_spi_master.h"
#include <stdio.h>
#include "cascoda-bm/cascoda_interface.h"
#include "cascoda-bm/cascoda_sensorif.h"
#include "cascoda_chili_gpio.h"
Include dependency graph for hal_spi_master.c:

Macros

#define SPI_MODULE_COUNT   2
 

Functions

err_t serial_write_data (uint8_t *write_data_buffer, uint8_t len)
 
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_configure_default (hal_spi_master_config_t *config)
 Configure SPI Master configuration structure with default values. 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_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_write (handle_t handle, uint8_t *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...
 
void hal_spi_master_set_chip_select_polarity (hal_spi_master_chip_select_polarity_t polarity)
 Set desired chip select polarity. 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...
 

Variables

hal_spi_master_chip_select_polarity_t hal_spi_master_chip_select_polarity = HAL_SPI_MASTER_CHIP_SELECT_DEFAULT_POLARITY
 

Detailed Description

SPI Master HAL layer implementation.

Macro Definition Documentation

◆ SPI_MODULE_COUNT

#define SPI_MODULE_COUNT   2

Function Documentation

◆ serial_write_data()

err_t serial_write_data ( uint8_t *  write_data_buffer,
uint8_t  len 
)

Variable Documentation

◆ hal_spi_master_chip_select_polarity