- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Start a timer when button pressed, when still pressed when timer expires issue a CySoftwareReset().
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Start a timer when button pressed, when still pressed when timer expires issue a CySoftwareReset().
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.