OSDN Git Service

[General] Licence changed to GPL2->GPL+LE cause of sdcc's libraries; See http://sdcc...
[openi2cradio/OpenI2CRadio.git] / i2c_io.h
1 /*
2  * OpenI2CRADIO
3  * I2C Header
4  * (C) 2013-06-10 K.Ohta <whatisthis.sowhat ai gmail.com>
5  * License: GPL2+LE
6  */
7 #include <sdcc-lib.h>
8 #include <pic18fregs.h> /* ONLY FOR PIC18x */
9
10 #include <i2c.h>
11
12 #ifndef I2C_IO_H
13 #define I2C_IO_H
14
15 #ifdef  __cplusplus
16 extern "C" {
17 #endif
18 /*
19  * #1
20  */
21 #define I2C_CLOCK_PARAM 19 // 8MHz/(4*(1+I2C_CLOCK_PARAM)) -> 100KHz
22 #define I2C_DEFAULT_MODE I2C_MASTER
23 #define I2C_SLEW_DEFAULT I2C_SLEW_ON
24
25 #define OPENASMASTER() i2c_open(I2C_DEFAULT_MODE, I2C_SLEW_DEFAULT, I2C_CLOCK_PARAM)
26 #define CLOSEASMASTER() i2c_close()
27 extern void i2c1_init(void);
28 extern void i2c2_init(void);
29
30 #ifdef  __cplusplus
31 }
32 #endif
33
34 #endif  /* I2C_IO_H */
35