1 |
/****************************************************************************
|
2 |
* File: i2c.h *
|
3 |
* Project: Header file for i2c communication module *
|
4 |
* Author: Kim H. Pedersen *
|
5 |
* Purpose: Send and receive characters on serial line using the functions *
|
6 |
* - init_serial: Initialize communication module *
|
7 |
* - send: Send size bytes from buffer *
|
8 |
* - receive: Receive size bytes into buffer *
|
9 |
* History: 21/01-05 KHPe Created *
|
10 |
****************************************************************************/
|
11 |
#ifndef _I2C_H_
|
12 |
#define _I2C_H_
|
13 |
|
14 |
// #define ReStartI2C StartI2C
|
15 |
|
16 |
typedef struct{
|
17 |
char DevAddr;
|
18 |
char NoBytes;
|
19 |
char *IOBuffer;
|
20 |
int RWAddress;
|
21 |
char WrInProgress;
|
22 |
}RWStruct;
|
23 |
|
24 |
void InitI2C(void);
|
25 |
char StartI2C(char I2CADD);
|
26 |
char ReStartI2C(char I2CADD);
|
27 |
void StopI2C(void);
|
28 |
char WriteI2CByte(char I2CByte);
|
29 |
char ReadI2CByte(char LastRead);
|
30 |
char WriteI2C(RWStruct *IOStruct); //char DevAddr, char NoBytes, char *WriteBuffer);
|
31 |
char ReadI2C(RWStruct *IOStruct); //char DevAddr, char NoBytes, char *ReadBuffer);
|
32 |
#endif /* _I2C_H_ */
|