megacode/pic/MDR/I2C.h

17 lines
468 B
C

#define __16f1847
#include <pic16f1847.h>
#include <stdint.h>
#define bool uint8_t
#define true 1
#define false 0
#define SCL _RB6 /* pin 12, external 24LC256 I2C EEPROM memory */
#define SDA _RB7 /* pin 13, external 24LC256 I2C EEPROM memory */
// Write a byte to I2C bus. Return 0 if ack by the slave.
bool i2c_write_byte(bool send_start, bool send_stop, unsigned char byte);
// Read a byte from I2C bus
unsigned char i2c_read_byte(bool nack, bool send_stop);