<commit_before>#include "MCP23008.h"

void write_mcp23008(unsigned char reg_addr,unsigned char data)
{
  // Start the I2C Write Transmission
  i2c_start(MCP23008_ID, MCP23008_ADDR, TW_WRITE);
  // Sending the Register Address
  i2c_write(reg_addr);
  // Write data to MCP23008 Register
  i2c_write(data);
  // Stop I2C Transmission
  i2c_stop();
}

unsigned char read_mcp23008(unsigned char reg_addr)
{
  char data;
  // Start the I2C Write Transmission
  i2c_start(MCP23008_ID, MCP23008_ADDR, TW_WRITE);
  // Read data from MCP23008 Register Address
  i2c_write(reg_addr);
  // Stop I2C Transmission
  i2c_stop();

  // Re-Start the I2C Read Transmission
  i2c_start(MCP23008_ID, MCP23008_ADDR, TW_READ);
  i2c_read(&data, 0); // 0 for NACK

  // Stop I2C Transmission
  i2c_stop();

  return data;
}
<commit_msg>Pass in a single byte for I2C address.<commit_after>#include "MCP23008.h"

void write_mcp23008(uint8_t reg_addr, uint8_t data)
{
  // Start the I2C write transmission
  i2c_start(MCP23008, TW_WRITE);

  // Then send register address
  i2c_write(reg_addr);

  // Write data to MCP23008 Register
  i2c_write(data);

  // Stop I2C Transmission
  i2c_stop();
}

uint8_t read_mcp23008(uint8_t reg_addr)
{
  char data;

  // Start the I2C write transmission
  i2c_start(MCP23008, TW_WRITE);

  // Then send register address
  i2c_write(reg_addr);

  // Stop I2C Transmission
  i2c_stop();

  // Re-Start the I2C Read Transmission
  i2c_start(MCP23008, TW_READ);
  i2c_read(&data, 0); // 0 for NACK

  // Stop I2C Transmission
  i2c_stop();

  return data;
}

{'fraction_non_alphanumeric': 0.0970625798212005, 'fraction_numerical': 0.08365261813537675, 'mean_word_length': 3.8215384615384616, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3552416', 'n_tokens_mistral': 699, 'n_tokens_neox': 606, 'n_words': 151}