Main Site Documentation

Getting started with Display T35


#1

I have just purchased a T35 display and I am trying out the code on the following link:

https://www.ghielectronics.com/docs/133/display-t35-module

I have followed the instructions except the tinyfnt was in the v4.3 folder, not 4.2. When I run the code I get the following error:

“The name ‘Resources’ does not exist in the current context”

Any ideas…

Thanks.

Richard


#2

Show us the code snippets you are using for initialization. This should be easy to fix once we see what you are doing.


#3

Is this the information you need?

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Hardware;

using GHI.Premium.Hardware;

#4

No, the actual code you wrote.

You don’t normally need to find a font in a folder, It is in Resources available in your Program main. Take a look at :

https://www.ghielectronics.com/community/codeshare/entry/863

And look at the USAGE tab on that page.

You should probably have could like this in your program:

 public partial class Program
    {
        Font mySmallFont = Resources.GetFont(Resources.FontResources.small);
        Font myLargeFont = Resources.GetFont(Resources.FontResources.NinaB);

#5

Sounds like you changed the Namespace in your Program.cs file but not in the Project Settings.
The Resources class is generated into the Namespace which is set in Project Settings.
Eather you add a suing for the Namespace in program.cs (or any other source file where you Access the Resources) or you also Change the Namespace in projectsettings


#6

The full code I am using is:

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Hardware;

using GHI.Premium.Hardware;

namespace Display_Troubleshooting_NETMF
{
     public class Program : Microsoft.SPOT.Application
     {
         public static Bitmap bmp = new Bitmap(320, 240);

         static Program myDisplayTestApp;

         public static void Main()
         {
             if (SystemMetrics.ScreenHeight == 0 || SystemMetrics.ScreenWidth == 0)
                 ResetDisplay();

             myDisplayTestApp = new Program();

             Microsoft.SPOT.Touch.Touch.Initialize(myDisplayTestApp);

             myDisplayTestApp.MainWindow = new Microsoft.SPOT.Presentation.Window();

             myDisplayTestApp.MainWindow.TouchDown += new TouchEventHandler(MainWindow_TouchDown);
             myDisplayTestApp.MainWindow.TouchUp += new TouchEventHandler(MainWindow_TouchUp);
             myDisplayTestApp.Run();

         }

         static void MainWindow_TouchUp(object sender, TouchEventArgs e)
         {
             Debug.Print("X: " + e.Touches[0].X + " Y: " + e.Touches[0].Y);
             bmp.DrawText("(" + e.Touches[0].X + "," + e.Touches[0].Y + ")", Resources.GetFont(Resources.FontResources.NinaB),
                Colors.Green, e.Touches[0].X, e.Touches[0].Y);
             bmp.Flush();
         }

         static void MainWindow_TouchDown(object sender, TouchEventArgs e)
         {
             bmp.Clear();
             Debug.Print("X: " + e.Touches[0].X + " Y: " + e.Touches[0].Y);
             bmp.DrawText("(" + e.Touches[0].X + "," + e.Touches[0].Y + ")", Resources.GetFont(Resources.FontResources.NinaB),
                 Colors.Red, e.Touches[0].X, e.Touches[0].Y);
             bmp.Flush();
         }

         static void ResetDisplay()
         {
             Debug.Print("Display not configured. Configuring mainboard to use display.");
             Debug.Print("Mainboard will need to be rebooted when finished");

             Configuration.LCD.Configurations lcdConfig = new Configuration.LCD.Configurations();

             lcdConfig.Width = 320;
             lcdConfig.Height = 240;

             // Only use if needed, see documentation.
             //lcdConfig.PriorityEnable = false;

             lcdConfig.OutputEnableIsFixed = true;
             lcdConfig.OutputEnablePolarity = true;

             lcdConfig.HorizontalSyncPolarity = false;
             lcdConfig.VerticalSyncPolarity = false;
             lcdConfig.PixelPolarity = true;

             lcdConfig.HorizontalSyncPulseWidth = 41;
             lcdConfig.HorizontalBackPorch = 27;
             lcdConfig.HorizontalFrontPorch = 51;
             lcdConfig.VerticalSyncPulseWidth = 10;
             lcdConfig.VerticalBackPorch = 8;
             lcdConfig.VerticalFrontPorch = 16;

             lcdConfig.PixelClockRateKHz = 10;

             bool bNeedReset = Configuration.LCD.Set(lcdConfig);

             Debug.Print("Mainboard can now be reset");

             System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
         }
     }
}

The error is highlighted in the code you highlighted.


#7

As I wrote,

I assume that the Namespace in the project settings is different to ‘Display_Troubleshooting_NETMF’ and by this the Resources class is in a different namespace.
Change the namespace in project settings to ‘Display_Troubleshooting_NETMF’ or add a
#using NamespaceAsInProjectSettings;
to your code at the beginning.

To edit the project properties:
right click on Project in Solution explorer and select Properties.
The default namespace is on top right of the Application tab.