Reset - TeensyUser/doc GitHub Wiki
All 3.x and 4.x Teensies can do a reset in software:
SCB_AIRCR = 0x05FA0004;
asm volatile ("dsb");
Similar to reset, but starts the bootlader:
asm volatile ("BKPT 254");
The Teensy 4 can be switched off in software, too.
!!Attention!! It switches off immedately, so adding this to setup() is a bad Idea.
SNVS_LPCR |= SNVS_LPCR_TOP; //Switch off now
asm volatile ("dsb");
For using the Power-Pin on the Teensy 4 you can use this library:
https://github.com/TeensyUser/doc/wiki/Teensy-Libraries#teensy-4041-power-button-support