Fast I2C communication between ESP8266 & PCF8591 I need faster communication between the ESP and the ADC, so I found this
https://github.com/pasko-zh/brzo_i2c.

Original wire Example

#include "Wire.h"
#define PCF8591 0x48
byte a0;

void setup() {
  Wire.begin(13, 14);
  Serial.begin(115200);
}

void loop() {
  Wire.beginTransmission(PCF8591);
  Wire.write(0x04);
  Wire.endTransmission();
  Wire.requestFrom(PCF8591, 5);

  a0 = Wire.read();
  a0 = Wire.read();

  Serial.println(a0);
  delay(1000);
}


Brzo I2C example 

#include "brzo_i2c.h"

uint8_t buffer[10];
uint8_t error = 0;
float temp = 0.0;

uint8_t ICACHE_RAM_ATTR get_temp(float *t) {
  uint8_t bcode = 0;
  brzo_i2c_start_transaction(0x48, 400);
  buffer[0] = 0x04;
  brzo_i2c_write(buffer, 1, false);
  brzo_i2c_read(buffer, 2, false);
  bcode = brzo_i2c_end_transaction();
  *t = ((buffer[0] &lt;&lt; 8) | buffer[1]);
  return bcode;
}

void setup() {
  delay(500);
  Serial.begin(115200);
  brzo_i2c_setup(13, 14, 2000);
}

void loop() {
  error = get_temp(&amp;temp);
  if (error == 0) {
    Serial.print("Temp = ");
    Serial.println(temp, 8);
  } else {
    Serial.print("Brzo error : ");
    Serial.println(error);
  }
  delay(500);
}


But I get always the same error.


  1 : Bus not free


I rewrote it in different ways, changing the frequency, pins and doing multiple transactions. The main reason I don't get it to work is the difference in the API.

There is no Wire.requestFrom(); in the brzo_i2c lib. So I need to read the value with brzo_i2c_read(buffer,2,false);.
This line

brzo_i2c_start_transaction(0x48,400);


Sets the SCL frequency to 400kHz.

According to the Datasheet for the PCF8591 the maximum SCL clock frequency is 100kHz.

The other issue may be the "repeated_start" flag on brzo_i2c_write.

If you look at the examples, and "apply" that to your code, your would do something like:

uint8_t ICACHE_RAM_ATTR get_temp(float *t){
  uint8_t bcode=0;
  brzo_i2c_start_transaction(0x48,100); // changed 400 to 100
  buffer[0]=0x04; 
  brzo_i2c_write(buffer,1,true); // changed to true because 
  brzo_i2c_read(buffer,2,false);
  bcode=brzo_i2c_end_transaction();
  *t=((buffer[0]&lt;&lt;8)|buffer[1]);
  return bcode;
}


My understanding of the code is that you would set repeated_start to true in the write if you want to then immediately read - which in your case you want to.