Skip to content

Choose if a pin state should persist through deep sleep? #6732

Open
@maholli

Description

@maholli

Goal

There are many cases when a user may want to conditionally set a pin high or low and then maintain that pin state during and after deep sleep.

A common example would be choosing whether to keep some external circuit enabled during deep sleep (like a GPS module searching for a fix).

  • Currently, this isn't possible since pins are reset just prior to entering deep sleep (in the case of the atmel-samd port).
  • On discord, @tannewt suggested PinAlarm might provide a hacky workaround since you can set pull=True to pull the pin in the opposite direction during sleep. This sort-of works for light sleep, but at least for the atmel-samd port, the usable pins are further reduced for deep sleep down to the few tamper pins.
    • Additionally, this workaround requires a deinit of the pin prior to sleep if the pin was configured as digitalio during normal operation and another pin reset upon wake. This makes it unusable for the GPS example since the module will still experience two resets are require it to begin searching for a fix from scratch.

To summarize

There should be a way to set flag a digitalio output pin during normal operation such that the logic level of the pin is not disrupted upon entering nor during deep sleep.

Does anyone have high-level thoughts on possible ways to achieve this? What about maintaining pin state upon wake? I'm not even sure it's feasible to not disrupt a pin as we exit deep sleep. Regardless, if we come up with something that isn't too complex, especially across ports, I can certainly help implement it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions