I’m using a SparkFun Mini Human Presence and Motion Sensor - STHS34PF80 (Qwiic) board in much the same way as the “Cat Presence Detector” by Madaroni And Cheese.
I’m using the STHS34PF80 to generate an interrupt that wakes an ESP8266 from deep sleep. The ESP8266 that switches on a MOSFET to power an RFID reader that reads the cat’s implanted RFID tag. Once the cats identity is confirmed, the ESP8266 drives a servo that opens the cats feeder.
My problem is that the RESET pin that wakes the ESP8266 from deep sleep has a pullup resistor to the 3.3v rail. This means that the interrupt signal from the STHS34PF80 must be active LOW. The default value is 0, active HIGH.
I have the EXAMPLE_2_Interrupts working on another pin (active high) but I cannot work out how to set the INT_H_L bit of the CTRL3 register.
Here is the function from EXAMPLE_2_Interrupts
mySensor.setInterruptMode(sths34pf80_int_mode_t val);
and the struct from the STHS34PF80_reg.h
typedef struct
{
enum {
STHS34PF80_PUSH_PULL = 0x0,
STHS34PF80_OPEN_DRAIN = 0x1,
} pin;
enum {
STHS34PF80_ACTIVE_HIGH = 0x0,
STHS34PF80_ACTIVE_LOW = 0x1,
} polarity;
} sths34pf80_int_mode_t;
int32_t sths34pf80_int_mode_set(stmdev_ctx_t *ctx, sths34pf80_int_mode_t val);
int32_t sths34pf80_int_mode_get(stmdev_ctx_t *ctx, sths34pf80_int_mode_t *val);
I just can’t figure out how it goes together…
Any help or suggestions gratefully accepted.