Ship/Hibernate mode firmware logic

Hello,

I'm working with the npm1300, and I was recently trying to implement sleep/hibernate mode. The datasheet states that before entering these modes we should check if we are connected to VBUS. It is suggested that you check the register EVENTSVBUSIN0SET. however, as far as I understand, this register contains latching events.

For example, the event EVENTVBUSDETECTED is set when VBUS is inserted the first time, and then will be set until manually cleared with the register EVENTSVBUSIN0CLR. This means that checking the register before going to hibernate mode is not enough, and one needs to implement either some state of VBUS in firmware or get a bit more creative with events and interrupts (for example clearing EVENTVBUSDETECTED only when VBUS is removed). 

Could you please confirm that my understanding is correct? Is there an alternative register that just tracks the state of VBUS (and other things maybe) without the latching behaviour of the EVENTSET?

Thanks! 

Related