Main Site Documentation

TE35 Touch Event


#1

Hi,

I’ve just gone through the T35 basic tutorial here http://wiki.tinyclr.com/index.php?title=Gadgeteer_Display and the code executes and debugs just fine however the touch events are not raised, how can I go about locating the reason for this? The framework is 4.2, device is a fez hydra.

Thanks


#2

Give this a try, it should get you started

http://www.tinyclr.com/forum/topic?id=8595


#3

Hi Scott_F,

Welcome to the community.

Unfortunately, Analog touch is not implemented in GHI’s 4.2 Framework at this time. Please follow Steven’s link for help on this matter.


#4

I like to add a note that calibration is not part of provided code. We are looking to add something by next release this month to handle this.


#5

Thanks guys, will give that a try. Out of interest, how come this isn’t automatically ported between framework versions? Were there breaking changes in the framework change?


#6

Because we want to improve it.


#7

@ Aron,

I’m having an issue w/ the driver. It works fine as a STATIC but if I change it to a normally instanced object I fail on getting Y pin.

Point of failure:

YcoordinatePin = new AnalogInput(Cpu.AnalogChannel.ANALOG_3); // PA20

Error:

Using mainboard GHI Electronics FEZHydra version 1.2
    #### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (4) ####
    #### Message: 
    #### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000] ####
    #### Microsoft.SPOT.Hardware.AnalogInput::.ctor [IP: 008b] ####
    #### Microsoft.SPOT.Hardware.AnalogInput::.ctor [IP: 0018] ####
    #### GameSlate12Q4POC.T35Touch::.ctor [IP: 0069] ####
    #### GameSlate12Q4POC.Program::KeepGadgeteerHappy [IP: 0004] ####
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll

My Code:

using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;


using GHI.OSHW.Hardware;
using GHI.OSHW.Hardware.LowLevel;

namespace HydraTouchTest
{
    public class T35Touch
    {

        #region Variables

        Register TOUCHSCREEN_ADC_CONTROLLER_CHANNEL_DISABLE_REGISTER = new Register(0xFFFD0014);
        private AnalogInput XcoordinatePin;
        private AnalogInput YcoordinatePin;
        private double XcoordinateData = 0;
        private double YcoordinateData = 0;
        private OutputPort XLpin;
        private OutputPort XRpin;
        private OutputPort YUpin;
        private OutputPort YDpin;

        InputPort floatingXRPin;
        InputPort floatingYDpin;

        #endregion

        #region Constructor

        public T35Touch()
        {
            XcoordinatePin = new AnalogInput(Cpu.AnalogChannel.ANALOG_1); // PA18 // pin5
            XcoordinatePin.Scale = 200.0;
            YUpin = new OutputPort(FEZHydra.Pin.PA20, false);// pin4
            YDpin = new OutputPort(FEZHydra.Pin.PB1, true);// pin6
            floatingXRPin = new InputPort(FEZHydra.Pin.PB28, false, Port.ResistorMode.Disabled);// pin7

            YcoordinatePin = new AnalogInput(Cpu.AnalogChannel.ANALOG_3); // PA20
            YcoordinatePin.Scale = 320.0;
            XLpin = new OutputPort(FEZHydra.Pin.PA18, false);
            XRpin = new OutputPort(FEZHydra.Pin.PB28, true);
            floatingYDpin = new InputPort(FEZHydra.Pin.PB1, false, Port.ResistorMode.Disabled);

            new Thread(MonitorTouch).Start();
        }

        #endregion

        #region Touch Monitor

        private void MonitorTouch()
        {
            int iX, iY;

            while (true)
            {
                iX = (int)XcoordinatePin.Read();
                iY = (int)YcoordinatePin.Read();

                if (iX != 0)
                    Debug.Print("Touch: " + iX + "," + iY);


                Thread.Sleep(10);
            }
        }

        #endregion

    }
}

#8

Hi Skewworks,

I think it is because you are declaring an Output port along with an Analog port on the same pin (PA20). My original code disposes the pins first.


#9

Yeah I totally didn’t notice the same pinage there, it must have been late. :slight_smile:


#10

Hi Guys, just wondering if there is any progress getting the touch events into the SDK? I’ve updated to v1.0.3 but it doesn’t look like its in there.

Thanks


#11

Has it really be 5 months since T35 displays stopped working on Hydra/G120? :whistle:

Come on guys, you got this!


#12

This came up in another thread few days ago. This is fixed on Hydra and will be released soon. I am not aware of any problem with G120


#13

@ Gus - Aron mentioned looking into the issue on the G120 here: http://www.tinyclr.com/forum/topic?id=9990&page=2#msg102400