DA14683: Implementing a "soft power button". Push to sleep. Push again to wake.

Hardware:

Custom DA14683 Board.

SDK 1.0.14.1081 (last updated in 2018)

Situation:

I need to implement a "soft power button".   This is a button that has the same user functionality as a physical power switch would have, but operates internally by initiating sleep/wake.  Push it to "turn off" the product.  Push it again to "turn on" the product.  Power consumption should be minimal in "powered off" mode.

The button on the DA14683 board is already working, and I can get a notification that it was pressed when the system is running, but I am unable to get the system to fully go to sleep permanently (it still wakes periodically), and I am unable to get the system to wake up from a button press when it is asleep.  

I also need the USB charging to either work while the system is sleeping, or wake the system when a USB cable is inserted.

 

Requirements:

1) If the system is powered on and operating:  when the button is pressed, the system should halt all operations and go into a low power sleep mode and not wake on it's own.  

2) If the system is sleeping: when the button is pressed, the system should power back up.  (Acceptable to do a full device reset)

3) If the system is sleeping: when the USB cable is plugged in, the system should ideally remain sleeping and charge the battery.  It is also acceptable for the insertion of a USB cable to wake the system and then start charging.

4) It is acceptable, and probably preferable, to have the system do a full reset when it comes out of sleep.  This makes the requirements for retaining memory much easier because I don't need to retain anything.

Questions:

1) Are there any demos that have the functionality of putting the system into sleep with the push of a button, and only having the system wake back up if the button is pushed again?

2) How do you wake the system when a USB cable is inserted?

3) Is there a way to "Force" the system to stop all operations and go to sleep without waking itself up periodically?  As I said, I don't need to retain any state since I can do a full system reset when the device wakes up.  The only requirements for functionality while it's asleep is to wake back up only if the button is pressed or if the USB cable is inserted.