Exemplo n.º 1
0
 // Construct the object. Set this class to handle the emulated
 // hardware's button interrupts.
 public ButtonPad(GpioButtonInputProvider sink, Button button, GpioPin pin)
 {
     this.sink   = sink;
     this.button = button;
     pin.SetDriveMode(GpioPinDriveMode.Input);
     pin.ValueChanged += Pin_ValueChanged;
 }
Exemplo n.º 2
0
        private TetrisApp()
        {
            // Create the object that configures the GPIO pins to buttons.
            GpioButtonInputProvider inputProvider = new GpioButtonInputProvider(null);

            // Create ExtendedWeakReference for high score table
            highScoreEWD = ExtendedWeakReference.RecoverOrCreate(
                typeof(TetrisApp),
                0,
                ExtendedWeakReference.c_SurvivePowerdown);
            // Set persistance priority
            highScoreEWD.Priority = (int)ExtendedWeakReference.PriorityLevel.Important;

            // Try to recover previously saved HighScore
            HighScore = (HighScoreTable)highScoreEWD.Target;

            // If nothing was recovered - create new
            if (HighScore == null)
            {
                HighScore = new HighScoreTable();
            }
        }