I2Cwrapper v0.5.0
Generic framework for Arduino I2C target devices
|
An I2C wrapper class for ESP32 sensors (touch, temp, hall). More...
An I2C wrapper class for ESP32 sensors (touch, temp, hall).
This class mimicks the original Arduino ESP32 core commands. It replicates all of the methods and transmits each method call via I2C to a target running the appropriate firmware.ino firmware, given that ESP32 sensors support is enabled at compile time. Functions and parameters without documentation will work just as their original, but you need to take the general restrictions into account (e.g. don't take a return value for valid without error handling).
Public Member Functions | |
ESP32sensorsI2C (I2Cwrapper *w) | |
Constructor. More... | |
void | touchSetCycles (uint16_t measure, uint16_t sleep) |
uint16_t | touchRead (uint8_t pin) |
Like the original. More... | |
void | enableInterrupts (uint8_t pin, uint16_t threshold, bool falling=true) |
Of course, you can't set your own callback funtion for the target. Instead, you can make a pin trigger an interrupt using the wrapper's global interrupt pin. Make sure to have defined it before per wrapper.setInterruptPin(). Will use interruptReason_ESP32sensorsTouch as interrupt reason and touch pin number (i.e. 0 to 9, for T0 to T9, not the raw hardware pin number) as unit. More... | |
int | hallRead () |
float | temperatureRead () |
ESP32sensorsI2C::ESP32sensorsI2C | ( | I2Cwrapper * | w | ) |
Constructor.
w | Wrapper object representing the target the pin is connected to. |
void ESP32sensorsI2C::enableInterrupts | ( | uint8_t | pin, |
uint16_t | threshold, | ||
bool | falling = true |
||
) |
Of course, you can't set your own callback funtion for the target. Instead, you can make a pin trigger an interrupt using the wrapper's global interrupt pin. Make sure to have defined it before per wrapper.setInterruptPin(). Will use interruptReason_ESP32sensorsTouch as interrupt reason and touch pin number (i.e. 0 to 9, for T0 to T9, not the raw hardware pin number) as unit.
pin | |
threshold | |
falling | [reserved, not usable yet with current ESP32 core] true to trigger on signal falling below the threshold (= touched), false to trigger on signal rising above threshold (= released). Uses touchInterruptSetThresholdDirection(). |
int ESP32sensorsI2C::hallRead | ( | ) |
float ESP32sensorsI2C::temperatureRead | ( | ) |
uint16_t ESP32sensorsI2C::touchRead | ( | uint8_t | pin | ) |
Like the original.
pin | Note, again, that if your controller is not an ESP32, the pin names T0..T9 will not be known, so use their raw pin equivalents. |
void ESP32sensorsI2C::touchSetCycles | ( | uint16_t | measure, |
uint16_t | sleep | ||
) |