/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / "Invert to Quit"

Username:     
Password:     
             

Forum

# 1   2007-10-28 02:13:31 "Invert to Quit"

dalewheat
Member
From: Dallas TX USA
Registered: 2007-10-10
Posts: 43
Website

"Invert to Quit"

Pressing the button to end a CircleOS application is fine & dandy as long as you don't need the button for anything else.  I've been using the following code to end my short demo programs:

Code:

   if ( BUTTON_GetState () == BUTTON_PUSHED ) {
      BUTTON_WaitForRelease ();
      BUTTON_SetMode ( BUTTON_ONOFF_FORMAIN );
      return MENU_Quit ();
   }

If it looks familiar, that's because it's from the Cubic Tutorial project.

If you'd rather flip the unit over to clear it, ala Etch-a-Sketch, use this code:

Code:

   if ( MEMS_GetInfo () -> OutZ < -1000 ) {
      BUZZER_SetMode ( BUZZER_SHORTBEEP );
      return MENU_Quit ();
   }

A quick up & down shake of the STM32 Primer will also do the trick.


Enjoy!

Thanks,

Dale Wheat

Offline

 

Board footer