Example of ESP-32 ULP I2C application which reads a sensor (BMP-180) and wakes up the main processors after a significant change of the measured values.
Note that the ULP is quite limited in program size and IO options. An alternative is to use an ATTiny as ULP processor, see:
https://github.com/tomtor/ESPTiny
Tested on IDF 4.1 with CMake build system
Note that this example uses a bit-banged I2C implementation, because the hardware ULP I2C support cannot read 16 bit values. This is not essential for the BMP-180, but some sensors like the ADS-1015 DO require 16-bit readouts.
In additon this example shows ULP stack handling and reusable subroutines examples, like
Wait some milliseconds
Compute abs value of register
Parts of the original C code from
https://github.com/adafruit/Adafruit-BMP085-Library
were translated to ESP assembly.
Be aware of an assembler bug: