SmartSnippets DA1459x SDK
Data Structures | Macros | Typedefs | Enumerations | Functions
ad_spi.h File Reference

SPI Controller access API. More...

#include "ad.h"
#include "hw_spi.h"
#include "hw_gpio.h"
#include "osal.h"
#include "resmgmt.h"
#include "sdk_defs.h"
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  ad_spi_io_conf_t
 SPI I/O configuration. More...
 
struct  ad_spi_driver_conf_t
 SPI driver configuration. More...
 
struct  ad_spi_controller_conf_t
 SPI controller configuration. More...
 

Macros

#define CONFIG_SPI_USE_ASYNC_TRANSACTIONS   (1)
 Controls whether SPI asynchronous transaction API will be used.
 
#define CONFIG_SPI_USE_SYNC_TRANSACTIONS   (1)
 Controls whether SPI synchronous transaction API will be used. More...
 

Typedefs

typedef void * ad_spi_handle_t
 SPI Handle returned by ad_spi_open()
 

Enumerations

enum  AD_SPI_ERROR
 enum with return values of API calls
 

Functions

void ad_spi_init (void)
 Initialize adapter. More...
 
ad_spi_handle_t ad_spi_open (const ad_spi_controller_conf_t *conf)
 Open SPI controller. More...
 
int ad_spi_reconfig (ad_spi_handle_t handle, const ad_spi_driver_conf_t *drv_conf)
 Reconfigure SPI controller. More...
 
int ad_spi_close (ad_spi_handle_t handle, bool force)
 Close SPI controller. More...
 
int ad_spi_io_config (HW_SPI_ID id, const ad_spi_io_conf_t *io, AD_IO_CONF_STATE state)
 Initialize controller pins to on / off io configuration. More...
 
int ad_spi_write (ad_spi_handle_t handle, const uint8_t *wbuf, size_t wlen)
 Perform a blocking write transaction. More...
 
int ad_spi_read (ad_spi_handle_t handle, uint8_t *rbuf, size_t rlen)
 Perform a blocking read transaction. More...
 
int ad_spi_write_read (ad_spi_handle_t handle, const uint8_t *wbuf, uint8_t *rbuf, size_t len)
 Perform a blocking write and read transaction. More...
 
void ad_spi_activate_cs (ad_spi_handle_t handle, uint8_t csid)
 Activate chip select for a specific device. More...
 
void ad_spi_deactivate_cs (ad_spi_handle_t handle)
 Deactivate chip select for a specific device. More...
 
void ad_spi_deactivate_cs_when_spi_done (ad_spi_handle_t handle)
 Wait for SPI interface to be idle and deactivate chip select. More...
 
int ad_spi_write_async (ad_spi_handle_t handle, const uint8_t *wbuf, size_t wlen, ad_spi_user_cb cb, void *user_data)
 Perform a non blocking write transaction. More...
 
int ad_spi_read_async (ad_spi_handle_t handle, const uint8_t *rbuf, size_t rlen, ad_spi_user_cb cb, void *user_data)
 Perform a blocking read transaction. More...
 
int ad_spi_write_read_async (ad_spi_handle_t handle, const uint8_t *wbuf, size_t wlen, uint8_t *rbuf, size_t rlen, ad_spi_user_cb cb, void *user_data)
 Perform asynchronous SPI write and then read transaction. It can be used as write command and read buffer operation. More...
 

Detailed Description

SPI Controller access API.

Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates. All rights reserved. Confidential Information.

This software ("Software") is supplied by Renesas Electronics Corporation and/or its affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable, revocable, non-sub-licensable right and license to use the Software, solely if used in or together with Renesas products. You may make copies of this Software, provided this copyright notice and disclaimer ("Notice") is included in all such copies. Renesas reserves the right to change or discontinue the Software at any time without notice.

THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS SOFTWARE.