// External Eprom Access. Jamie Balfour. Dec 2002.
// No Liability Accepted.
#include "I2C Low Level.h"
#include "Eprom Functions.h"
unsigned char RetrieveData( unsigned char ControlByte, unsigned char HighByte, unsigned char LowByte )
{
unsigned char required_data=0, test=1;
while( test )
{
SendStart();
test=SendDeviceAddress( ControlByte, WRITE ); /* Wait for eprom to signal it is ready */
}
SendData(HighByte);
SendData(LowByte);
Restart();
SendDeviceAddress( ControlByte, READ );
required_data = GetData();
SendStop();
return required_data;
}
void ByteWrite( unsigned char ControlByte, unsigned char HighByte, unsigned char LowByte, unsigned char DataByte )
{
unsigned char required_data=0, test=1;
while( test )
{
SendStart();
test=SendDeviceAddress( ControlByte, WRITE ); /* Wait for eprom to signal it is ready */
}
SendData(HighByte);
SendData(LowByte);
SendData(DataByte);
SendStop();
}