Moved and unpacked examples to sdcc/device/examples/ds390
[fw/sdcc] / device / examples / ds390 / i2c390 / i2clole.h
1 #ifndef _I2C_H
2 #define _I2C_H
3
4 #define I2C_BUFSIZE     128
5
6 extern char I2CReset(void);
7 extern char I2CStart(void);
8 extern char I2CStop(void);
9 extern char I2CSendStop(char addr, char count, 
10                                  char send_stop);
11 extern char I2CReceive(char addr, char count);
12 extern char I2CSendReceive(char addr, char tx_count, char rx_count);
13 extern char I2CByteOut(char);
14 extern void I2CDumpError(char);
15 extern void I2CDelay(volatile long);
16
17 /*
18  * Macro for normal send transfer ending with a stop condition
19  */
20
21 #define I2CSend(addr, count)   I2CSendStop(addr, count, 1)
22
23 /*
24  * Global variables in i2clole.c
25  */
26
27 extern char i2cTransmitBuffer[];     /* Transmit buffer */
28 extern char i2cReceiveBuffer[];     /* Receive buffer */
29 extern char i2cError;          /* Set to last error value, see below */
30
31 /*
32  * I2C error values
33  */
34
35 #define I2CERR_OK       0       /* No error */
36 #define I2CERR_NAK      1       /* No ACK from slave */
37 #define I2CERR_LOST     2       /* Arbitration lost */
38 #define I2CERR_BUS      3       /* Bus is stuck (not used yet) */
39 #define I2CERR_TIMEOUT  4       /* Timeout on bus */
40
41 #endif
42
43
44
45
46
47
48