1 /* 2 * Ben NanoNote I2C communication. 3 * 4 * Copyright (C) 2013 Paul Boddie 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 */ 11 12 #ifndef __I2C_H__ 13 #define __I2C_H__ 14 15 #include <ubb/ubb.h> 16 #include "bool.h" 17 18 /* I2C modifiers. */ 19 20 #define I2C_READ 1 21 #define I2C_WRITE 0 22 23 /* Functions. */ 24 25 void i2c_init(); 26 void i2c_start(); 27 void i2c_stop(); 28 void i2c_ack(bool ack); 29 uint8_t i2c_recv(); 30 void i2c_recvmany(uint8_t *data, uint8_t len); 31 void i2c_wait(); 32 bool i2c_send(uint8_t data); 33 bool i2c_sendmany(uint8_t *data, uint8_t len); 34 35 /* Function aliases. */ 36 37 #define i2c_repeated_start i2c_start 38 39 #endif /* __I2C_H__ */