app_spi.h File Reference

Header file containing functions prototypes of SPI app library. More...

#include "app_io.h"
#include "app_dma.h"
#include "app_drv_error.h"
#include "app_drv_config.h"
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  app_spi_pin_t
 SPI IO Structures. More...
 
struct  app_spi_pin_cfg_t
 SPI IO configuration Structures. More...
 
struct  app_spi_dma_cfg_t
 SPI configuration definition. More...
 
struct  app_spi_evt_t
 SPI event structure definition. More...
 
struct  spi_env_t
 SPI device structure definition. More...
 
struct  app_spi_params_t
 SPI parameters structure definition. More...
 

Macros

#define APP_SPI_PIN_ENABLE   1
 
#define APP_SPI_PIN_DISABLE   0
 

Typedefs

typedef void(* app_spi_evt_handler_t) (app_spi_evt_t *p_evt)
 SPI event callback definition. More...
 

Enumerations

enum  app_spi_id_t {
  APP_SPI_ID_SLAVE,
  APP_SPI_ID_MASTER,
  APP_SPI_ID_MAX
}
 SPI module Enumerations definition. More...
 
enum  app_spi_evt_type_t {
  APP_SPI_EVT_ERROR,
  APP_SPI_EVT_TX_CPLT,
  APP_SPI_EVT_RX_CPLT,
  APP_SPI_EVT_TX_RX_CPLT,
  APP_SPI_EVT_ABORT
}
 SPI event Enumerations definition. More...
 
enum  app_spi_state_t {
  APP_SPI_INVALID = 0,
  APP_SPI_ACTIVITY
}
 App spi state types. More...
 
enum  app_spi_dma_state_t {
  APP_SPI_DMA_INVALID = 0,
  APP_SPI_DMA_ACTIVITY
}
 App spi dma state types. More...
 

Functions

uint16_t app_spi_init (app_spi_params_t *p_params, app_spi_evt_handler_t evt_handler)
 Initialize the APP SPI DRIVER according to the specified parameters in the app_spi_params_t and app_spi_evt_handler_t. More...
 
uint16_t app_spi_deinit (app_spi_id_t id)
 De-initialize the APP SPI DRIVER peripheral. More...
 
uint16_t app_spi_abort (app_spi_id_t id)
 Abort spi communication with Interrupt. More...
 
uint16_t app_spim_transmit_with_ia (app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t *p_data, uint16_t data_length)
 SPI master transmit with 1-byte inst and 3-byte addr, can use to write flash/display/eeprom, etc. More...
 
uint16_t app_spim_receive_with_ia (app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t dummy_bytes, uint8_t *p_data, uint16_t data_length)
 SPI master receive with 1-byte inst and 3-byte addr and 0~4 dummy Byte, can use to read flash/display/eeprom, etc. More...
 
uint16_t app_spi_receive_sync (app_spi_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout)
 Receive in master or slave mode an amount of data in blocking mode. More...
 
uint16_t app_spi_receive_async (app_spi_id_t id, uint8_t *p_data, uint16_t size)
 Receive in master or slave mode an amount of data in non-blocking mode with Interrupt. More...
 
uint16_t app_spi_transmit_sync (app_spi_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout)
 Transmits in master or slave mode an amount of data in blocking mode. More...
 
uint16_t app_spi_transmit_async (app_spi_id_t id, uint8_t *p_data, uint16_t size)
 Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt. More...
 
uint16_t app_spi_transmit_receive_sync (app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t size, uint32_t timeout)
 Transmits and receive in master or slave mode an amount of data in blocking mode. More...
 
uint16_t app_spi_transmit_receive_async (app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t size)
 Transmits and receive in master or slave mode an amount of data in non-blocking mode with Interrupt. More...
 
uint16_t app_spi_read_eeprom_sync (app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_size, uint32_t rx_size, uint32_t timeout)
 Read an amount of data from EEPROM in blocking mode. More...
 
uint16_t app_spi_read_eeprom_async (app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_size, uint32_t rx_size)
 Read an amount of data from EEPROM in non-blocking mode with Interrupt. More...
 
spi_handle_tapp_spi_get_handle (app_spi_id_t id)
 Return the SPI handle. More...
 
uint16_t app_spi_write_memory_async (app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_tx_data, uint32_t cmd_size, uint32_t tx_size)
 Transmits in master or slave mode an amount of data in non-blocking mode with DMA. More...
 
uint16_t app_spi_read_memory_async (app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_rx_data, uint32_t cmd_size, uint32_t rx_size)
 Read an amount of data from EEPROM in non-blocking mode with DMA. More...
 
uint16_t app_spi_receive_high_speed_sync (app_spi_id_t id, uint8_t *p_data, uint16_t size)
 [High speed] Receive in master or slave mode an amount of data in blocking mode. More...
 
uint16_t app_spi_transmit_high_speed_sync (app_spi_id_t id, uint8_t *p_data, uint16_t size)
 [High speed] Transmit in master or slave mode an amount of data in blocking mode. More...
 

Detailed Description

Header file containing functions prototypes of SPI app library.

Author
BLE Driver Team
Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file app_spi.h.