spiextend 2.0.0.0
spiextend.h File Reference

This file contains API for SPI Extend Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  spiextend_t
 SPI Extend Click context object. More...
 
struct  spiextend_cfg_t
 SPI Extend Click configuration object. More...
 
struct  spiextend_config_data_t
 SPI Extend Click configuration data. More...
 
struct  spiextend_status_data_t
 SPI Extend Click status data. More...
 
struct  spiextend_event_data_t
 SPI Extend Click event data. More...
 
struct  spiextend_fault_data_t
 SPI Extend Click Fault data. More...
 

Macros

#define SPIEXTEND_REG_CONFIG   0x00
 SPI Extend description register.
 
#define SPIEXTEND_REG_STATUS   0x01
 
#define SPIEXTEND_REG_EVENT   0x02
 
#define SPIEXTEND_REG_INT_EN   0x03
 
#define SPIEXTEND_REG_FAULT   0x04
 
#define SPIEXTEND_REG_WORD_LENGTH   0x05
 
#define SPIEXTEND_REG_SCRATCH   0x06
 
#define SPIEXTEND_ACCEL14_REG_WHO_AM_I   0x0F
 Aceel 14 description register.
 
#define SPIEXTEND_ACCEL14_REG_CTRL1_XL   0x10
 
#define SPIEXTEND_ACCEL14_REG_CTRL3_C   0x12
 
#define SPIEXTEND_ACCEL14_REG_OUT_TEMP_L   0x20
 
#define SPIEXTEND_ACCEL14_REG_OUT_TEMP_H   0x21
 
#define SPIEXTEND_ACCEL14_REG_OUTX_L_A   0x28
 
#define SPIEXTEND_ACCEL14_REG_OUTX_H_A   0x29
 
#define SPIEXTEND_ACCEL14_REG_OUTY_L_A   0x2A
 
#define SPIEXTEND_ACCEL14_REG_OUTY_H_A   0x2B
 
#define SPIEXTEND_ACCEL14_REG_OUTZ_L_A   0x2C
 
#define SPIEXTEND_ACCEL14_REG_OUTZ_H_A   0x2D
 
#define SPIEXTEND_STATUS_ACTIVE   0x00
 SPI Extend status.
 
#define SPIEXTEND_STATUS_INACTIVE   0x01
 
#define SPIEXTEND_ACCEL14_CTRL1_XL_POWER_UP   0xA0
 SPI Extend description setting for Accel 14 config.
 
#define SPIEXTEND_ACCEL14_CTRL1_XL_HIGH_RES_FS   0x00
 
#define SPIEXTEND_ACCEL14_CTRL1_XL_GSEL_4G   0x08
 
#define SPIEXTEND_ACCEL14_CTRL3_C_BOOT_NORMAL   0x00
 
#define SPIEXTEND_ACCEL14_CTRL3_C_BDU_READ_UPDATE   0x40
 
#define SPIEXTEND_ACCEL14_CTRL3_C_INT_ACTIVE_HIGH   0x00
 
#define SPIEXTEND_ACCEL14_CTRL3_C_PP_OD_PUSH_PULL   0x00
 
#define SPIEXTEND_ACCEL14_CTRL3_C_SIM_SPI_4_WIRE   0x00
 
#define SPIEXTEND_ACCEL14_CTRL3_C_IF_INC_ENABLE   0x04
 
#define SPIEXTEND_ACCEL14_CTRL3_C_SW_RESET_DIS   0x00
 
#define SPIEXTEND_ACCEL14_SPI_WRITE   0x00
 SPI Extend Accel 14 communication.
 
#define SPIEXTEND_ACCEL14_SPI_READ   0x80
 
#define SPIEXTEND_CMD_CLEAR_EVENT   0x00
 SPI Extend clear event.
 
#define SPIEXTEND_SLAVE_SELECT_SS1   0x01
 SPI Extend slave select.
 
#define SPIEXTEND_SLAVE_SELECT_SS2   0x02
 
#define SPIEXTEND_SLAVE_SELECT_SS3   0x03
 
#define SPIEXTEND_PIN_STATE_LOW   0x00
 SPI Extend pin state.
 
#define SPIEXTEND_PIN_STATE_HIGH   0x01
 
#define SPIEXTEND_SPI_WRITE   0x00
 SPI Extend communication.
 
#define SPIEXTEND_SPI_READ   0x01
 
#define SPIEXTEND_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define SPIEXTEND_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define SPIEXTEND_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  spiextend_return_value_t { SPIEXTEND_OK = 0 , SPIEXTEND_ERROR = -1 }
 SPI Extend Click return value data. More...
 

Functions

void spiextend_cfg_setup (spiextend_cfg_t *cfg)
 SPI Extend configuration object setup function.
 
err_t spiextend_init (spiextend_t *ctx, spiextend_cfg_t *cfg)
 SPI Extend initialization function.
 
err_t spiextend_default_cfg (spiextend_t *ctx)
 SPI Extend default configuration function.
 
err_t spiextend_generic_write (spiextend_t *ctx, uint8_t reg, uint8_t data_in)
 SPI Extend data writing function.
 
err_t spiextend_generic_read (spiextend_t *ctx, uint8_t reg, uint8_t *data_out)
 SPI Extend data reading function.
 
void spiextend_get_config (spiextend_t *ctx, spiextend_config_data_t *config_data)
 SPI Extend get the configuration function.
 
void spiextend_set_config (spiextend_t *ctx, spiextend_config_data_t config_data)
 SPI Extend set the configuration function.
 
void spiextend_get_status (spiextend_t *ctx, spiextend_status_data_t *status_data)
 SPI Extend get the status function.
 
void spiextend_get_event (spiextend_t *ctx, spiextend_event_data_t *event_data)
 SPI Extend get the event function.
 
void spiextend_clear_event (spiextend_t *ctx)
 SPI Extend clear the event function.
 
void spiextend_enable_int (spiextend_t *ctx, spiextend_event_data_t event_data)
 SPI Extend enable int function.
 
void spiextend_get_fault (spiextend_t *ctx, spiextend_fault_data_t *fault_data)
 SPI Extend get the fault state function.
 
uint8_t spiextend_get_word_length (spiextend_t *ctx)
 SPI Extend get the word length function.
 
void spiextend_set_word_length (spiextend_t *ctx, uint8_t word_length)
 SPI Extend set the word length function.
 
uint8_t spiextend_get_scratch (spiextend_t *ctx)
 SPI Extend get scratch function.
 
void spiextend_set_scratch (spiextend_t *ctx, uint8_t scratch)
 SPI Extend set scratch function.
 
void spiextend_set_ss1 (spiextend_t *ctx, uint8_t en_cs)
 SPI Extend set SS1 pin state function.
 
void spiextend_set_ss2 (spiextend_t *ctx, uint8_t en_rst)
 SPI Extend set SS2 pin state function.
 
void spiextend_set_ss3 (spiextend_t *ctx, uint8_t en_an)
 SPI Extend set SS3 pin state function.
 
uint8_t spiextend_check_int (spiextend_t *ctx)
 SPI Extend check interrupt status function.
 
void spiextend_rmt_spi_write (spiextend_t *ctx, uint8_t *p_tx_data, uint16_t n_bytes)
 SPI Extend generic SPI write data in Remote Mode function.
 
void spiextend_rmt_spi_read (spiextend_t *ctx, uint8_t *p_rx_data, uint16_t n_bytes)
 SPI Extend generic SPI read data in Remote Mode function.
 
void spiextend_rmt_write (spiextend_t *ctx, uint8_t reg, uint8_t tx_data, uint8_t sel_slave)
 SPI Extend generic write data in Remote Mode function.
 
uint8_t spiextend_rmt_read (spiextend_t *ctx, uint8_t reg, uint8_t sel_slave)
 SPI Extend generic read data in Remote Mode function.
 
void spiextend_rmt_multi_write (spiextend_t *ctx, uint8_t reg, uint8_t *p_tx_data, uint16_t n_bytes, uint8_t sel_slave)
 SPI Extend generic multi write data in Remote Mode function.
 
void spiextend_rmt_multi_read (spiextend_t *ctx, uint8_t reg, uint8_t *p_rx_data, uint8_t n_bytes, uint8_t sel_slave)
 SPI Extend generic multi read data in Remote Mode function.
 

Detailed Description

This file contains API for SPI Extend Click Driver.

Enumeration Type Documentation

◆ spiextend_return_value_t

SPI Extend Click return value data.

Predefined enum values for driver return values.

Enumerator
SPIEXTEND_OK 
SPIEXTEND_ERROR