##// END OF EJS Templates
Removed error on fat32 library, seems now to be able navigate among sectors in...
Removed error on fat32 library, seems now to be able navigate among sectors in both directions. Improved SDLCD drawing performances by almost 1000x.

File last commit:

r64:b702edc52366 dev_alexis
r68:104125d87b89 dev_alexis
Show More
i2c.c
132 lines | 2.7 KiB | text/x-c | CLexer
Added Simulator target to run code on x86 and debug functions....
r63 /*------------------------------------------------------------------------------
-- 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
Jeandet Alexis
sync
r64 -- Mail : alexis.jeandet@member.fsf.org
Added Simulator target to run code on x86 and debug functions....
r63 -------------------------------------------------------------------------------*/
#include <i2c.h>
#include <gpio.h>
int i2ctimeout=1000*1000;
i2c_t i2copen(int count)
{
return -1;
}
i2c_t i2copenandconfig(int count,uint32_t cfg,uint32_t speed,uint32_t SDA,uint32_t SCL)
{
i2c_t dev = i2copen(count);
if(dev!=-1)
{
i2cclose(dev);
i2csetpins(dev,SDA,SCL);
i2copen(count);
i2csetspeed(dev,speed);
i2cenable(count);
}
return dev;
}
int i2cclose(i2c_t dev)
{
return 1;
}
int i2csetpins(i2c_t dev, uint32_t SDA, uint32_t SCL)
{
if((dev<i2c4)&&(dev>=i2c1))
{
return 0;
}
return -1;
}
int i2cenable(i2c_t dev)
{
if((dev<i2c4)&&(dev>=i2c1))
{
return 0;
}
return -1;
}
int i2cdisable(i2c_t dev)
{
if((dev<i2c4)&&(dev>=i2c1))
{
return 0;
}
return -1;
}
int i2csetspeed(i2c_t dev,uint32_t speed)
{
if((dev<i2c4)&&(dev>=i2c1))
{
return 0;
}
return -1;
}
int i2cbusy(i2c_t dev)
{
if((dev<i2c4)&&(dev>=i2c1))
{
return 0; /* Dev isn't busy */
}
return -1; /* Error, dev is out of range */
}
int i2cwrite(i2c_t dev,char address,char* data,int count)
{
if((dev<i2c4)&&(dev>=i2c1))
{
return 0;
}
return -1;
}
int i2cread(i2c_t dev,char address,char* data,int count)
{
if((dev<i2c4)&&(dev>=i2c1))
{
return 0;
}
return -1;
}
int i2cStatusCheck(i2c_t dev,int32_t flagMask)
{
int32_t flag;
if((dev<i2c4)&&(dev>=i2c1))
{
return 0;
}
return -1;
}