| 151 | kaklik | 1 | #ifndef I2CINTERFACE_H
 | 
        
           |  |  | 2 | #define I2CINTERFACE_H
 | 
        
           |  |  | 3 |   | 
        
           |  |  | 4 | /*
 | 
        
           |  |  | 5 |     Copyright (C) 2004    John Orlando
 | 
        
           |  |  | 6 |   | 
        
           |  |  | 7 |    AVRcam: a small real-time image processing engine.
 | 
        
           |  |  | 8 |   | 
        
           |  |  | 9 |     This program is free software; you can redistribute it and/or
 | 
        
           |  |  | 10 |     modify it under the terms of the GNU General Public
 | 
        
           |  |  | 11 |     License as published by the Free Software Foundation; either
 | 
        
           |  |  | 12 |     version 2 of the License, or (at your option) any later version.
 | 
        
           |  |  | 13 |   | 
        
           |  |  | 14 |     This program is distributed in the hope that it will be useful,
 | 
        
           |  |  | 15 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
        
           |  |  | 16 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
        
           |  |  | 17 |     General Public License for more details.
 | 
        
           |  |  | 18 |   | 
        
           |  |  | 19 |     You should have received a copy of the GNU General Public
 | 
        
           |  |  | 20 |     License along with this program; if not, write to the Free Software
 | 
        
           |  |  | 21 |     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
        
           |  |  | 22 |   | 
        
           |  |  | 23 |    For more information on the AVRcam, please contact:
 | 
        
           |  |  | 24 |   | 
        
           |  |  | 25 |    john@jrobot.net
 | 
        
           |  |  | 26 |   | 
        
           |  |  | 27 |    or go to www.jrobot.net for more details regarding the system.
 | 
        
           |  |  | 28 | */
 | 
        
           |  |  | 29 | /***********************************************************
 | 
        
           |  |  | 30 | 	Module Name: I2CInterface.h
 | 
        
           |  |  | 31 | 	Module Date: 04/10/2004                         
 | 
        
           |  |  | 32 | 	Module Auth: John Orlando
 | 
        
           |  |  | 33 |   | 
        
           |  |  | 34 | 	Description: This module provides the external interface 
 | 
        
           |  |  | 35 | 	to the I2C hardware available on the mega8.  It also 
 | 
        
           |  |  | 36 | 	contains defines and declarations for how the I2C 
 | 
        
           |  |  | 37 | 	interface will be used in this system.
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 |     Revision History:
 | 
        
           |  |  | 40 |     Date        Rel Ver.    Notes
 | 
        
           |  |  | 41 |     4/10/2004      0.1     Module created
 | 
        
           |  |  | 42 |     6/30/2004      1.0     Initial release for Circuit Cellar
 | 
        
           |  |  | 43 |                            contest.
 | 
        
           |  |  | 44 | ***********************************************************/
 | 
        
           |  |  | 45 |   | 
        
           |  |  | 46 | #include "CommonDefs.h"	
 | 
        
           |  |  | 47 |   | 
        
           |  |  | 48 | /*  Structures and Typedefs */
 | 
        
           |  |  | 49 | typedef struct
 | 
        
           |  |  | 50 | {
 | 
        
           |  |  | 51 | 	unsigned char configReg;
 | 
        
           |  |  | 52 | 	unsigned char data;
 | 
        
           |  |  | 53 | } i2cCmd_t;
 | 
        
           |  |  | 54 |   | 
        
           |  |  | 55 | /*  Defines   */
 | 
        
           |  |  | 56 | /*  The I2C interface will run at 100 KHz (the OV6620 can
 | 
        
           |  |  | 57 | 	support up to 400 KHz, but this hasn't been tested) */
 | 
        
           |  |  | 58 | #define I2C_SPEED 100000
 | 
        
           |  |  | 59 |   | 
        
           |  |  | 60 |   | 
        
           |  |  | 61 | /*  External Function Prototypes */
 | 
        
           |  |  | 62 | extern void  I2CInt_init(void);
 | 
        
           |  |  | 63 | extern void  I2CInt_writeData(unsigned char address, unsigned char *data, unsigned char bytes);
 | 
        
           |  |  | 64 | extern void  I2CInt_readData(unsigned char address, unsigned char *data, unsigned char bytes);
 | 
        
           |  |  | 65 | extern bool_t I2CInt_isI2cBusy(void);
 | 
        
           |  |  | 66 |   | 
        
           |  |  | 67 |   | 
        
           |  |  | 68 |   | 
        
           |  |  | 69 | #endif	
 | 
        
           |  |  | 70 |   |