According to some of the documentation (and a random issue on GitHub), the SH200Q should be hooked up to GPIO35 to wake the stick from deep sleep upon activity. While running, I can see this interrupt being triggered, but it never actually wakes from deep sleep.
Here's the code I use to set up the interrupt:
// Enable acc interrupt
buf = 1<<1;
M5.IMU.I2C_Write_NBytes(SH200I_ADDRESS, 0x14, 1, &buf);
// Set acc threshold
buf = 100;
M5.IMU.I2C_Write_NBytes(SH200I_ADDRESS, 0x17, 1, &buf);
// Set amount of time acc must be in threshold before interrupt is triggered
buf = 4;
M5.IMU.I2C_Write_NBytes(SH200I_ADDRESS, 0x19, 1, &buf);
// set gyro x/y/z as inputs for interrupt (bit 7 enables the use of TIME_THRESHOLD)
buf = 1<<4 | 1<<5 | 1<<6 | 1<<7;
M5.IMU.I2C_Write_NBytes(SH200I_ADDRESS, 0x1B, 1, &buf);
And this is the line that should enable wake on GPIO35 activity:
esp_sleep_enable_ext0_wakeup((gpio_num_t)35, 1); // set ext0 to wake up when GPIO35 is high
I've also tried enabling wakeup on one of the external M5Stick buttons as a sanity check.. that worked fine.
My question; is the SH200Q's interrupt actually hooked up to anything, and if so what? Or is there some error in my code?