Main Site Documentation

Retrieve the current LCD configuration


#1

Hello

On my project, i need to use some the pin that are usually connected to the LCD for other purposes. This involves to run:

GHIElectronics.NETMF.Hardware.Configuration.LCD.Set(LCD.HeadlessConfig)

After resetting the board, the pin can be used as normal IOs.

The problem is that to deploy my application on a large amount of board, I will be obliged to have a code that reset only if the config is not the good one.

My first idea was to find something like: GHIElectronics.NETMF.Hardware.Configuration.LCD.Get() in order to test before running the set and reseting (by software) the board

But this does not exist. Could it be added in following release?

If not and in order to wait for such a functionnalities, how to properly handle the exception that is generated when a pin is not available?

the idea could be :


try {LED_power.io=new OutputPort(EMX.Pin.IO65,false);}
catch(System.Exception????????????????)
{
GHIElectronics.NETMF.Hardware.Configuration.LCD.Set(LCD.HeadlessConfig)
reset the board...
}

May be some of you have already some tips to help me in achieving that?

Thanks in advance for your help.


#2

Read carefull http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/html/cf4f6ce9-920d-5b02-8b85-b9d756441929.htm

[quote]public static bool Set(Configuration.LCD.Configurations config)

Return Value
true if configurations where updated. false if configurations did not change.[/quote]


#3

Ok you right, this will be usefull. I don’t know why I was expecting getter and setter as in java or EMF…

Thank for your help.


#4

Here’s what I did:

bool cfg_chg=GHIElectronics.NETMF.Hardware.Configuration.LCD.Set(Configuration.LCD.HeadlessConfig); // to use the LCD reserved IOs, return true if config has changed false otherwise.
            if (cfg_chg==true)
            {
              GHIElectronics.NETMF.Hardware.LowLevel.Watchdog.Enable(1000);
            while(true);
            }

#5

There is a Reset (or Reboot) method somewhere in the Hardware (I think) namespace. I think it also uses the watchdog but I recommend using it (it’s a better practice to use what is already made).


#6

You are right, unfortunately I did not find this instruction. Sometimes looking for a method or a class is painfull on netmf or GHI library… unfortunately there’s no search tool in the GHI online library…


#7

It’s from .NET MF standard, not from GHI.
Here it is: http://msdn.microsoft.com/en-us/library/ee435763.aspx


#8

COOOOOL, many thanks GodFather89, I was looking for this functionnality in GHI library whereas it was in .NETMF.

My code will look nicer :slight_smile: