コード例 #1
0
        static void display_TouchDown(DisplayNhd5 sender, TouchEventArgs e)
        {
//            Debug.Print("Finger " + e.FingerNumber + " down!");
//            Debug.Print("Where " + e.X + "," + e.Y);
            //
            // Check if backlight is off and if so, we will switch it back
            // on and consume the touch
            //
            if (BacklightOff)
            {
                BacklightOff = false;
                //LCDbacklight.Write(true);

                ResetBacklightInternal();   // Reset the timer

                LCDTurnedOn = true;         // We should ignore the touch up
                return;
            }
            else
            {
                ResetBacklightInternal();   // Each touch will reset the timer
            }
            touches[0].X = e.X;
            touches[0].Y = e.Y;
            GlideTouch.RaiseTouchDownEvent(null, new GHI.Glide.TouchEventArgs(touches));
        }
コード例 #2
0
        public CapTouchDriver(I2CDevice sharedBus)
        {
            display = new DisplayNhd5(sharedBus);

            //LCDbacklight = new OutputPort(GHI.Pins.G120.P1_19, true);
            //LCDbacklight.Write(true);
            msBacklightTime  = 0;           // Default is off
            msDisplayTimeout = 0;

            display.TouchUp   += display_TouchUp;
            display.TouchDown += display_TouchDown;
            display.ZoomIn    += display_ZoomIn;
            display.ZoomOut   += display_ZoomOut;

            touches    = new Microsoft.SPOT.Touch.TouchInput[1];
            touches[0] = new TouchInput();
            //
            // Using interrupt (for G120)
            //
            //touchPin = new InterruptPort(GHI.Pins.G120.P0_25, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);

            touchPin              = new InterruptPort(GHI.Pins.G120.P2_21, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
            touchPin.OnInterrupt += touchPin_OnInterrupt;
            //
            // Create thread the handle the backlight timeout
            //
            Thread threadBacklight = new Thread(backlightHandler);

            threadBacklight.Start();
        }
コード例 #3
0
        static void display_TouchUp(DisplayNhd5 sender, TouchEventArgs e)
        {
//            Debug.Print("Finger " + e.FingerNumber + " up!");
            if (LCDTurnedOn)
            {
                LCDTurnedOn = false;
                return;
            }
            touches[0].X = e.X;
            touches[0].Y = e.Y;
            GlideTouch.RaiseTouchUpEvent(null, new GHI.Glide.TouchEventArgs(touches));
        }
コード例 #4
0
 void display_ZoomIn(DisplayNhd5 sender, EventArgs e)
 {
     Debug.Print("Zoom in");
 }
コード例 #5
0
 void display_ZoomOut(DisplayNhd5 sender, EventArgs e)
 {
     Debug.Print("Zoom out");
 }