some over sampling magic is applied to get 10 bit resolution.
my guess: ADC samples with 4MSamples/s. not certain about that.
read_sar_dout(sardata);
for (i = 0; i < 8; i++) {
sar_dout += sardata[i];
ADC_DBG("%d, ", sardata[i]);
}
tout = (sar_dout + 8) >> 4; //tout is 10 bits fraction
what do you think is all this glue code for? disabling adc after sampling?
i2c_writeReg_Mask_def(i2c_saradc, i2c_saradc_en_test, 1); //select test mux
while (GET_PERI_REG_BITS(0x60000D50, 26, 24) > 0); //wait r_state == 0
CLEAR_PERI_REG_MASK(0x60000D5C, 0x200000);
SET_PERI_REG_MASK(0x60000D60, 0x1); //force_en=1
CLEAR_PERI_REG_MASK(0x60000D60, 0x1); //force_en=1
we have seen a software I2C master in the examples, but the ADC Module uses other routines to talk to the i2c ADC.
Is this simply On-Chip: native i2c, off Chip: bitbang i2c?
tinhead wrote:from the current specs "ESP8266EX integrates a generic purpose 10-bit analog ADC.
Where is the "current specs" ? I don't see it in the documentation links.