src.dualinventive.com/dinet/libdi_fw/include/di_fw/i2c.h

51 lines
1.5 KiB
C
Executable File

/**
* @file include/di_fw/i2c.h
* @brief I2C header file
* @date August 26, 2015
* @author A.A.W.M. Ruijs
* @copyright 2015 Dual Inventive Technology Centre B.V.
*/
#ifndef INCLUDE_DI_FW_I2C_DI_H_
#define INCLUDE_DI_FW_I2C_DI_H_
#include <stdint.h>
#include <di_fw/os.h>
/**
* initiation of I2C
*/
void di_fw_i2c_init(I2CDriver *i2cp);
/**
* read data over I2C bus
* @param i2cp pointer to I2C driver
* @param address address of the device
* @param readdata pointer to the place where the data need to be written
* @param read_len len of th readdata buffer
*/
msg_t di_fw_i2c_read(I2CDriver *i2cp, const uint16_t address, uint8_t *readdata, size_t read_len);
/**
* write data over I2C bus
* @param i2cp pointer to I2C driver
* @param address address of the device
* @param writedata pointer to the data that need to be written
* @param write_len length of writedata
*/
msg_t di_fw_i2c_write(I2CDriver *i2cp, const uint16_t address, uint8_t *writedata, size_t write_len);
/**
* write data over I2C bus and read data back
* @param i2cp pointer to I2C driver
* @param address address of the device
* @param writedata pointer to the data that need to be written
* @param write_len length of writedata
* @param readdata pointer to the place where the data need to be written
* @param read_len len of th readdata buffer
*/
msg_t di_fw_i2c_transfer(I2CDriver *i2cp, const uint16_t address, uint8_t *writedata, size_t write_len,
uint8_t *readdata, size_t read_len);
#endif /* INCLUDE_DI_FW_I2C_DI_H_ */