You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#2685 only adds light sleep during time.sleep. We should add a new mechanic for sleeping until an alarm.
An alarm can be anything a microcontroller supports during sleep such as RTC alarm, pin change interrupt and comparator. The alarms should be in separate modules so that the microcontrollers can support different ones.
Then, one sleep_until_alarm() function can take any number of alarms. It will return the object that woke it up.
The text was updated successfully, but these errors were encountered:
importsleepioimporttimeimportalarm.pinimportalarm.timepin0_alarm=alarm.pin.PinLevelAlarm(board.IO0, True, enable_pull=True)
time_alarm=alarm.pin.TimeAlarm(time.monotonic() +10.0)
whileTrue:
# start with a light sleep until an alarm triggers.alarm=sleepio.sleep_until_alarm(pin0_alarm, time_alarm)
# do something based on what alarmedifalarm==pin0_alarm:
print("pin change")
elifalarm==time_alarm:
print("time out")
#2685 only adds light sleep during
time.sleep
. We should add a new mechanic for sleeping until an alarm.An alarm can be anything a microcontroller supports during sleep such as RTC alarm, pin change interrupt and comparator. The alarms should be in separate modules so that the microcontrollers can support different ones.
Then, one
sleep_until_alarm()
function can take any number of alarms. It will return the object that woke it up.The text was updated successfully, but these errors were encountered: