<commit_before>/*
	EEPROM24C02.cpp - Library for communicating with EEPROM24C02.
	Created by <NAME>, 20.03.2015
*/
#include <Arduino.h>
#include <Wire.h>
#include "EEPROM24C02.h"

/*
	Default private constructor.
*/
EEPROM24C02::EEPROM24C02(){
	recData = 0;
}

/*
	Overloaded constructor.
*/
EEPROM24C02::EEPROM24C02(int address):EEPROM24C02::EEPROM24C02(){
	_address = address;
}

/*
	Default destructor.
*/
EEPROM24C02::~EEPROM24C02(){
	//Nothing to destruct.
}

/*
	Function: read
		Reads from EEPROM24C02 memory address.
	Parameters:
		data - data written to memory (byte)
	Returns:
		Integer - 0 successful write, anything else error.
*/
int EEPROM24C02::read(int addr){
	int error;
	Wire.beginTransmission(_address);
	Wire.write(addr);
	if((error = Wire.endTransmission()) != 0)
		return error;
	Wire.requestFrom(_address, 1);
	while (Wire.available()){
		recData = Wire.read();
	}
}

/*
	Function: write
		Writes to EEPROM24C02 memory address.
	Parameters:
		data - data written to the memory address (byte)
	Returns:
		Integer - 0 successful write, anything else error.
*/
int EEPROM24C02::write(int addr, byte data){
	Wire.beginTransmission(_address);
	Wire.write(addr);
	Wire.write(data);
	return Wire.endTransmission(); 
}

/*
	Function: write
		Writes to EEPROM24C02 memory address.
	Parameters:
		data - data written to the memory address (byte)
	Returns:
		Integer - 0 successful write, anything else error.
*/
int EEPROM24C02::write2bytes(int addr, int data){
	Wire.beginTransmission(_address);
	Wire.write(addr);
	Wire.write(data & 0xFF);	//LSB
	Wire.write(data >> 8);		//MSB
	return Wire.endTransmission(); 
}


/*
	Function: getRecDeta
		Gets received data from the EEPROM24C02.
	Parameters:
		Array to be modified and filled with data (byte[])
*/
byte EEPROM24C02::getRecData(){
	return recData;
}<commit_msg>[modified] comments explaining what functions do<commit_after>/*
	EEPROM24C02.cpp - Library for communicating with EEPROM24C02.
	Created by <NAME>, 20.03.2015
*/
#include <Arduino.h>
#include <Wire.h>
#include "EEPROM24C02.h"

/*
	Default private constructor.
*/
EEPROM24C02::EEPROM24C02(){
	recData = 0;
}

/*
	Overloaded constructor.
*/
EEPROM24C02::EEPROM24C02(int address):EEPROM24C02::EEPROM24C02(){
	_address = address;
}

/*
	Default destructor.
*/
EEPROM24C02::~EEPROM24C02(){
	//Nothing to destruct.
}

/*
	Function: read
		Reads from EEPROM24C02 memory address.
	Parameters:
		addr - address to start reading from (byte)
	Returns:
		Integer - 0 successful read, anything else error.
*/
int EEPROM24C02::read(int addr){
	int error;
	Wire.beginTransmission(_address);
	Wire.write(addr);
	if((error = Wire.endTransmission()) != 0)
		return error;
	Wire.requestFrom(_address, 1);
	while (Wire.available()){
		recData = Wire.read();
	}
}

/*
	Function: write
		Writes to EEPROM24C02 memory address.
	Parameters:
		data - data written to the memory address (byte)
	Returns:
		Integer - 0 successful write, anything else error.
*/
int EEPROM24C02::write(int addr, byte data){
	Wire.beginTransmission(_address);
	Wire.write(addr);
	Wire.write(data);
	return Wire.endTransmission(); 
}

/*
	Function: write
		Writes to EEPROM24C02 memory address.
	Parameters:
		data - data written to the memory address (byte)
	Returns:
		Integer - 0 successful write, anything else error.
*/
int EEPROM24C02::write2bytes(int addr, int data){
	Wire.beginTransmission(_address);
	Wire.write(addr);
	Wire.write(data & 0xFF);	//LSB
	Wire.write(data >> 8);		//MSB
	return Wire.endTransmission(); 
}


/*
	Function: getRecDeta
		Gets received data from the EEPROM24C02.
	Parameters:
		Array to be modified and filled with data (byte[])
*/
byte EEPROM24C02::getRecData(){
	return recData;
}
{'fraction_non_alphanumeric': 0.12658912631863672, 'fraction_numerical': 0.05031106302407357, 'mean_word_length': 4.367198838896952, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4327074', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1284, 'n_words': 346}