Analog Devices / platform_drivers

Dependents:   EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more

Embed: (wiki syntax)

« Back to documentation index

i2c.cpp File Reference

i2c.cpp File Reference

Implementation of I2C Mbed platform driver interfaces. More...

Go to the source code of this file.

Functions

int32_t i2c_init_noos (struct i2c_desc **desc, const struct i2c_init_param *param)
 Initialize the I2C communication peripheral.
int32_t i2c_remove (struct i2c_desc *desc)
 Free the resources allocated by i2c_init_noos().
int32_t i2c_write_noos (struct i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
 Write data to a slave device.
int32_t i2c_read_noos (struct i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
 Read data from a slave device.

Detailed Description

Implementation of I2C Mbed platform driver interfaces.

Copyright (c) 2019 - 2021 Analog Devices, Inc. All rights reserved.

This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Definition in file i2c.cpp.


Function Documentation

int32_t i2c_init_noos ( struct i2c_desc **  desc,
const struct i2c_init_param *  param 
)

Initialize the I2C communication peripheral.

Parameters:
desc- The I2C descriptor.
param- The structure that contains the I2C parameters.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 48 of file i2c.cpp.

int32_t i2c_read_noos ( struct i2c_desc *  desc,
uint8_t *  data,
uint8_t  bytes_number,
uint8_t  stop_bit 
)

Read data from a slave device.

Parameters:
desc- The I2C descriptor.
data- Buffer that will store the received data.
bytes_number- Number of bytes to read.
stop_bit- Stop condition control. Example: 0 - A stop condition will not be generated; 1 - A stop condition will be generated.
Returns:
SUCCESS in case of success, FAILURE otherwise.

The MBED I2C API is reversed for parameter 4 Instead of stop_bit - it has

Parameters:
repeated- Repeated start, true - don't send stop at end default value is false. Inverting here to keep the no-OS/platform_drivers API

Definition at line 172 of file i2c.cpp.

int32_t i2c_remove ( struct i2c_desc *  desc )

Free the resources allocated by i2c_init_noos().

Parameters:
desc- The I2C descriptor.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 106 of file i2c.cpp.

int32_t i2c_write_noos ( struct i2c_desc *  desc,
uint8_t *  data,
uint8_t  bytes_number,
uint8_t  stop_bit 
)

Write data to a slave device.

Parameters:
desc- The I2C descriptor.
data- Buffer that stores the transmission data.
bytes_number- Number of bytes to write.
stop_bit- Stop condition control. Example: 0 - A stop condition will not be generated; 1 - A stop condition will be generated.
Returns:
SUCCESS in case of success, FAILURE otherwise.

The MBED I2C API is reversed for parameter 4 Instead of stop_bit - it has

Parameters:
repeated- Repeated start, true - don't send stop at end default value is false. Inverting here to keep the no-OS/platform_drivers API

Definition at line 140 of file i2c.cpp.