SCM20260D Dev Display Rotation

I am using a SCM20260D Dev board with the official demo - downloaded today with nuget packages updated from 2.2.0.100 to 2.3.0.1000. Firmware is 2.3.0.1000

Demo display and touch works perfectly .

My problem is I want to use the screen rotated 180 degrees.

I modified the display controller settings to have a rotation of 180 degrees.

var controllerSetting = new GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings {
    // 480x272
    Width = 480,
    Height = 272,
    DataFormat = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565,
    PixelClockRate = 10000000,
    PixelPolarity = false,
    DataEnablePolarity = false,
    DataEnableIsFixed = false,
    HorizontalFrontPorch = 2,
    HorizontalBackPorch = 2,
    HorizontalSyncPulseWidth = 41,
    HorizontalSyncPolarity = false,
    VerticalFrontPorch = 2,
    VerticalBackPorch = 2,
    VerticalSyncPulseWidth = 10,
    VerticalSyncPolarity = false,
    Orientation = DisplayOrientation.Degrees180,    //this line added
}; 

This rotates the display 180 degrees as expected - the touch response is not rotated 180 degrees (obviously) but the touch is still responsive.

If I modify the touch initializations as below to also rotate the touch orientation 180 degrees there is no touch response at all.

Am I missing something obvious to get the touch to function correctly with the screen rotated 180 deg?

  public static void InitializeTouch() {
     var i2cController = I2cController.FromName(SC20260.I2cBus.I2c1);

     var settings = new I2cConnectionSettings(0x38) {
         BusSpeed = 100000,
         AddressFormat = I2cAddressFormat.SevenBit,
     };

     var i2cDevice = i2cController.GetDevice(settings);

     var gpioController = GpioController.GetDefault();
     var interrupt = gpioController.OpenPin(SC20260.GpioPin.PJ14);

   
     touch = new FT5xx6Controller(i2cDevice, interrupt);
     touch.TouchDown += Touch_TouchDown;
     touch.TouchUp += Touch_TouchUp;
     touch.Orientation = FT5xx6Controller.TouchOrientation.Degrees180;    //this line added 
 }

you need to add width and height
because the driver internally do rotate 180

x = Width - x

 touch.Width = 480; // or your screen width
 touch.Height = 272; // or your screen height

It will work after adding that.

Thanks @Dat_Tran it now works perfectly :grinning:

1 Like