/*------------------------------------------------------------------------------ -- This file is a part of the libuc, microcontroler library -- Copyright (C) 2012, Alexis Jeandet -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- -- Author : Alexis Jeandet -- Mail : alexis.jeandet@gmail.com -------------------------------------------------------------------------------*/ #ifndef I2C_H #define I2C_H #include #include #include #ifdef __cplusplus extern "C" { #endif typedef int i2c_t; #define i2c1 0 #define i2c2 1 #define i2c3 2 #define i2c4 3 #define i2c5 4 #define i2c6 5 #define i2c7 6 #define i2c8 7 #define i2c9 8 extern int i2ctimeout; extern i2c_t i2copen(int count); extern i2c_t i2copenandconfig(int count ,uint32_t cfg,uint32_t speed,uint32_t SDA,uint32_t SCL); extern int i2cclose(i2c_t dev); extern int i2csetpins(i2c_t dev,uint32_t SDA,uint32_t SCL); extern int i2cenable(i2c_t dev); extern int i2cdisable(i2c_t dev); //extern int i2csetconfig(i2c_t dev); extern int i2csetspeed(i2c_t dev,uint32_t speed); //extern int i2csetdatabits(i2c_t* dev,uartbits_t databits); extern int i2cwrite(i2c_t dev,char address,char* data,int count); extern int i2cread(i2c_t dev,char address,char* data,int count); extern int i2cbusy(i2c_t dev); extern int i2cStatusCheck(i2c_t dev,int32_t flagMask); #ifdef __cplusplus } #endif #endif //I2C_H