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

I2C device access API. More...

#include "ad.h"
#include "hw_i2c.h"
#include "hw_dma.h"
#include "hw_gpio.h"
#include "osal.h"
#include "resmgmt.h"

Go to the source code of this file.

Data Structures

struct  ad_i2c_io_conf_t
 I2C I/O configuration. More...
 
struct  ad_i2c_driver_conf_t
 I2C driver configuration. More...
 
struct  ad_i2c_controller_conf_t
 I2C controller configuration. More...
 

Macros

#define CONFIG_I2C_USE_ASYNC_TRANSACTIONS   (1)
 Controls whether I2C asynchronous transaction API will be used. More...
 
#define CONFIG_I2C_USE_SYNC_TRANSACTIONS   (1)
 Controls whether I2C synchronous transaction API will be used. More...
 

Typedefs

typedef void * ad_i2c_handle_t
 I2C Handle returned by ad_i2c_open()
 
typedef void(* ad_i2c_user_cb) (void *user_data, HW_I2C_ABORT_SOURCE error)
 Asynchronous callback function. More...
 

Enumerations

enum  AD_I2C_ERROR
 I2C adapter error codes. More...
 

Functions

void ad_i2c_init (void)
 Initialize adapter. More...
 
ad_i2c_handle_t ad_i2c_open (const ad_i2c_controller_conf_t *conf)
 Open I2C controller. More...
 
int ad_i2c_reconfig (ad_i2c_handle_t p, const ad_i2c_driver_conf_t *conf)
 Reconfigure I2C controller. More...
 
int ad_i2c_close (ad_i2c_handle_t p, bool force)
 Close I2C controller. More...
 
int ad_i2c_io_config (HW_I2C_ID id, const ad_i2c_io_conf_t *io, AD_IO_CONF_STATE state)
 Initialize controller pins to on / off io configuration. More...
 
int ad_i2c_write (ad_i2c_handle_t p, const uint8_t *wbuf, size_t wlen, uint8_t condition_flags)
 Perform a blocking write transaction. More...
 
int ad_i2c_write_with_to (ad_i2c_handle_t p, const uint8_t *wbuf, size_t wlen, uint8_t condition_flags, OS_TICK_TIME timeout)
 Perform a blocking write transaction with time out. More...
 
int ad_i2c_read (ad_i2c_handle_t p, uint8_t *rbuf, size_t rlen, uint8_t condition_flags)
 Perform a blocking read transaction. More...
 
int ad_i2c_read_with_to (ad_i2c_handle_t p, uint8_t *rbuf, size_t rlen, uint8_t condition_flags, OS_TICK_TIME timeout)
 Perform a blocking read transaction with time out. More...
 
int ad_i2c_write_read (ad_i2c_handle_t p, const uint8_t *wbuf, size_t wlen, uint8_t *rbuf, size_t rlen, uint8_t condition_flags)
 Perform synchronous write/read transaction. More...
 
int ad_i2c_write_read_with_to (ad_i2c_handle_t p, const uint8_t *wbuf, size_t wlen, uint8_t *rbuf, size_t rlen, uint8_t condition_flags, OS_TICK_TIME timeout)
 Perform synchronous write/read transaction with time out. More...
 
void ad_i2c_wait_while_master_busy (ad_i2c_handle_t p)
 Wait while I2C master device is busy. More...
 
int ad_i2c_write_async (ad_i2c_handle_t p, const uint8_t *wbuf, size_t wlen, ad_i2c_user_cb cb, void *user_data, uint8_t condition_flags)
 Perform a non blocking write transaction. More...
 
int ad_i2c_read_async (ad_i2c_handle_t p, uint8_t *rbuf, size_t rlen, ad_i2c_user_cb cb, void *user_data, uint8_t condition_flags)
 Perform a non blocking read transaction. More...
 
int ad_i2c_write_read_async (ad_i2c_handle_t p, const uint8_t *wbuf, size_t wlen, uint8_t *rbuf, size_t rlen, ad_i2c_user_cb cb, void *user_data, uint8_t condition_flags)
 Perform write and asynchronous read I2C transaction. More...
 

Detailed Description

I2C device 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.