Hello! I'm working on a project that embeds a Teensy 3.2 which is doing quite a lot .. it's running Teensy Audio, sending MIDI over USB, providing some debug over USB serial, and talking to an IMU/accelerometer chip over I2c.
All of that works, which is amazing! But now I'm trying to implement power savings using the Snooze library, and it's not really working as it's supposed to. Depending on the configs I've tried, the sleep() method either doesn't go to sleep properly or doesn't wake up properly. For debugging purposes I have managed to get it to wake on one button press, but only by disabling that button for the rest of the app. The actual po_wake pin that Snooze.digital is configured to listen to on RISING is going high but still no wakeup. And a 3000ms Snooze.timer() is also not working. Something is screwy.
I wonder if the things I'm trying to do are even allowed:
-- I need to wake up on any button press, so I'm running SnoozeDigital.pinmode() on the same two pins that are already attached to the Bounce2 library. But when I do that, it seems that Snooze always detects a button press and wakes immediately. Do I need to somehow detach Bounce2 and attach Snooze before sleeping, and then switch back on wakeup?
-- I am using the digital, usbserial and audio drivers. usbserial is supposed to let the teensy play well with USB serial during sleep & wake. But actually serial output from the teensy hangs after wake. (Although the computer does detect a USB serial device.) Do I need to reset the serial port somehow after sleeping? Does the fact that I'm also sending USB MIDI events mean that I need to do something different here, or is that also managed by usbserial ?
-- The IMU chip is generating interrupts when new data arrives. Do I need to disable interrupts before sleep? Teensy Audio uses interrupts too, and maybe Bounce2 does, I'm not sure. Does Snooze use interrupts in some way that might be incompatible with my situation?
Thanks for any advice,
-mykle-
All of that works, which is amazing! But now I'm trying to implement power savings using the Snooze library, and it's not really working as it's supposed to. Depending on the configs I've tried, the sleep() method either doesn't go to sleep properly or doesn't wake up properly. For debugging purposes I have managed to get it to wake on one button press, but only by disabling that button for the rest of the app. The actual po_wake pin that Snooze.digital is configured to listen to on RISING is going high but still no wakeup. And a 3000ms Snooze.timer() is also not working. Something is screwy.
I wonder if the things I'm trying to do are even allowed:
-- I need to wake up on any button press, so I'm running SnoozeDigital.pinmode() on the same two pins that are already attached to the Bounce2 library. But when I do that, it seems that Snooze always detects a button press and wakes immediately. Do I need to somehow detach Bounce2 and attach Snooze before sleeping, and then switch back on wakeup?
-- I am using the digital, usbserial and audio drivers. usbserial is supposed to let the teensy play well with USB serial during sleep & wake. But actually serial output from the teensy hangs after wake. (Although the computer does detect a USB serial device.) Do I need to reset the serial port somehow after sleeping? Does the fact that I'm also sending USB MIDI events mean that I need to do something different here, or is that also managed by usbserial ?
-- The IMU chip is generating interrupts when new data arrives. Do I need to disable interrupts before sleep? Teensy Audio uses interrupts too, and maybe Bounce2 does, I'm not sure. Does Snooze use interrupts in some way that might be incompatible with my situation?
Thanks for any advice,
-mykle-