Out-of-office display, GFX
 All Classes Files Functions Variables Enumerations Enumerator Groups
i2cDriver.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Andreas Misje
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
25 #ifndef _I2CDRIVER_H
26 #define _I2CDRIVER_H
27 
28 #include <stdbool.h>
29 #include <stddef.h>
30 
36 #define I2C_NO 1
37 
41 #define I2C_TRX_BUFFER_SIZE 32
42 
47 {
76 };
77 
83 extern volatile enum i2c_states i2c_state;
84 
96 extern volatile bool i2c_stayInErrorState;
97 
102 {
124 };
125 
131 extern volatile enum i2c_errors i2c_error;
132 
136 void i2c_reset();
137 
143 bool i2c_busy();
144 
152 void i2c_init( int brg, bool enableSlewRateControl, int priority );
153 
160 void i2c_disable();
161 
169 void i2c_enable();
170 
187 int i2c_putc( unsigned char address, unsigned char reg, unsigned char data );
188 
207 int i2c_puts( unsigned char address, unsigned char reg, unsigned char *data,
208  size_t len );
209 
226 int i2c_getc( unsigned char address, unsigned char reg );
227 
246 int i2c_gets( unsigned char address, unsigned char reg, size_t len );
247 
266 int i2c_getData( unsigned char *data, size_t len );
267 
268 
269 #endif // _I2CDRIVER_H
270