Read Power On/Off Pin RT1062

Is there a way to read the value of the Power On/Off pin on the RT1062? I’m looking for a way to use the 5 seconds while the Power On/Off pin is held low to shutdown my app gracefully.

Yes:

import machine

SNVS_BASE = 0x400D_4000
SNVS_HPSR = SNVS_BASE + 0x14

while True:
    print(machine.mem32[SNVS_HPSR] & (1 << 6))

Read chapter 20 in the reference manual for all the cool stuff you have access too. There’s 32-bytes of RAM that keeps it state on power off too.