Reset by software

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

Hi !

   

In my project I want to use button to different modes. Short press make for example print status  and long press make software reset to device.

   

How to do this ? Any idea please.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Start a timer when button pressed, when still pressed when timer expires issue a CySoftwareReset().

   

 

   

Bob

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Start a timer when button pressed, when still pressed when timer expires issue a CySoftwareReset().

   

 

   

Bob

0 Likes
urchc_1533771
Level 5
Level 5
5 likes given First like received First like given

Thanks !

0 Likes
Anonymous
Not applicable

I would suggest setting a flag when the timer expires rather than directly resetting, as the device could (theoretically) reboot and read the button switch as being "on" from before the device reset.

   

If you used a flag, and waited until the end of the button press to reset, then you would remove the possibility of the software reading the button as being "on" when it resets, but it depends on what your implementation needs I suppose.

0 Likes