arduino-libraries / ArduinoLowPower

Powersave features for SAMD boards
GNU Lesser General Public License v2.1
81 stars 57 forks source link

[TEST] Disable USB on sleep #8

Open facchinm opened 5 years ago

facchinm commented 5 years ago

This commit tries to solve https://github.com/arduino-libraries/ArduinoLowPower/issues/7 ; must be used in conjuction with https://github.com/arduino/ArduinoCore-samd/pull/361

Expected behaviour: the USB core is now totally disabled during standby (eg. it cannot receive a WAKEUP from the host PC). At every other kind of wakeup (RTC/gpio) the board re-enumerate itself, as if it was the first attach(). All OS should support this cleanly, however the port name could change or the serial monitor in use could not pick up the new board. All serial monitors should be closed and reopened after a successful resume.

wlcable commented 3 years ago

I am testing code on a Adafruit Feather M0 (samd21) and these changes are working for me. Windows finds the "new" device with no problem. So far it has been the same comm port but I have to reconnect, as expected. Nice work!

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.