##// END OF EJS Templates
Libuc make templates extracted from main script, to make it more modular
Libuc make templates extracted from main script, to make it more modular

File last commit:

r6:9626d775d625 default
r7:16404fe7ec6c default
Show More
iic.h
70 lines | 2.1 KiB | text/x-c | CLexer
/*------------------------------------------------------------------------------
-- This file is a part of the libuc, microcontroler library
-- Copyright (C) 2011, 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 IIC_H
#define IIC_H
#include "LPC17xx.h"
enum iicctrlvals
{
i2noerr,
i2noack,
i2arbloss,
i2busy,
i2timeout
};
typedef enum iicctrlvals i2ctrl;
struct lpc17XXi2cRegs
{
unsigned long I2CONSET;
unsigned long I2STAT;
unsigned long I2DAT;
unsigned long I2ADR;
unsigned long I2SCLH;
unsigned long I2SCLL;
unsigned long I2CONCLR;
};
typedef volatile struct lpc17XXi2cRegs i2cDev;
extern i2ctrl i2cwrite(i2cDev* dev,char address,char*data,int* cnt);
extern i2ctrl i2cwrite2(i2cDev* dev,char address,char*cmd,int* cmdcnt,char*data,int* datcnt);
extern i2ctrl i2cread(i2cDev* dev,char address,char*data,int* cnt);
extern i2cDev* i2copen(int count);
extern void i2cenable(i2cDev* dev);
extern void i2cdisable(i2cDev* dev);
extern void i2csetup(i2cDev* dev,int clkH,int clkL);
extern unsigned char i2cgetpclkfactor(i2cDev* dev);
extern void i2csetpclkfactor(i2cDev* dev,unsigned char pclkfactor);
extern void i2csetdatarate(i2cDev* dev,unsigned int dataRate);
#endif